Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef36f45

Browse files
committed
FIX: macosx, always put timers on main thread
The main thread is the one that is running when started, so we should put all timers we control on that thread. Otherwise we need to start and control runloops on the other threads which may or may not be started. This is particularly important for draw_idle() calls that may be sent from a separate thread where work was being done, but the draw should happen on the main thread still.
1 parent 5a34696 commit ef36f45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/_macosx.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ static void context_cleanup(const void* info)
18691869
CFTimeInterval interval;
18701870
PyObject* py_interval = NULL, * py_single = NULL, * py_on_timer = NULL;
18711871
int single;
1872-
runloop = CFRunLoopGetCurrent();
1872+
runloop = CFRunLoopGetMain();
18731873
if (!runloop) {
18741874
PyErr_SetString(PyExc_RuntimeError, "Failed to obtain run loop");
18751875
return NULL;

0 commit comments

Comments
 (0)