Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fix OpenGL segfaulting when running self.play or self.wait (#2734)

Noam Zaks412950500339
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index 397fab6a8..1ddcd13bd 100644
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -1008,6 +1008,24 @@ class Scene:
All other keywords are passed to the renderer.
"""
+ # Make sure this is running on the main thread
+ if threading.current_thread().name != "MainThread":
+ kwargs.update(
+ {
+ "subcaption": subcaption,
+ "subcaption_duration": subcaption_duration,
+ "subcaption_offset": subcaption_offset,
+ }
+ )
+ self.queue.put(
+ (
+ "play",
+ args,
+ kwargs,
+ )
+ )
+ return
+
start_time = self.renderer.time
self.renderer.play(self, *args, **kwargs)
run_time = self.renderer.time - start_time