Skip to content

Commit 4129505

Browse files
authored
Fix OpenGL segfaulting when running self.play or self.wait (#2734)
* make play run only on main thread * prefer dict.update
1 parent d3bdefb commit 4129505

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

manim/scene/scene.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,24 @@ def play(
10081008
All other keywords are passed to the renderer.
10091009
10101010
"""
1011+
# Make sure this is running on the main thread
1012+
if threading.current_thread().name != "MainThread":
1013+
kwargs.update(
1014+
{
1015+
"subcaption": subcaption,
1016+
"subcaption_duration": subcaption_duration,
1017+
"subcaption_offset": subcaption_offset,
1018+
}
1019+
)
1020+
self.queue.put(
1021+
(
1022+
"play",
1023+
args,
1024+
kwargs,
1025+
)
1026+
)
1027+
return
1028+
10111029
start_time = self.renderer.time
10121030
self.renderer.play(self, *args, **kwargs)
10131031
run_time = self.renderer.time - start_time

0 commit comments

Comments
 (0)