From ef36f451e8cf98e214901d53fd5955939f92d8e8 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Sun, 26 Mar 2023 09:59:42 -0600 Subject: [PATCH] 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. --- src/_macosx.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_macosx.m b/src/_macosx.m index 30fdf8fbd75c..d124ee3322b9 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -1869,7 +1869,7 @@ static void context_cleanup(const void* info) CFTimeInterval interval; PyObject* py_interval = NULL, * py_single = NULL, * py_on_timer = NULL; int single; - runloop = CFRunLoopGetCurrent(); + runloop = CFRunLoopGetMain(); if (!runloop) { PyErr_SetString(PyExc_RuntimeError, "Failed to obtain run loop"); return NULL;