Merge branch 'blender-v2.90-release' into master

This commit is contained in:
2020-08-11 13:32:41 +02:00
2 changed files with 21 additions and 2 deletions

View File

@@ -227,7 +227,14 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
context_dict_back = CTX_py_dict_get(C); context_dict_back = CTX_py_dict_get(C);
/**
* It might be that there is already a Python context override. We don't want to remove that
* except when this operator call sets a new override explicitly. This is necessary so that
* called operator runs in the same context as the calling code by default.
*/
if (context_dict != NULL) {
CTX_py_dict_set(C, (void *)context_dict); CTX_py_dict_set(C, (void *)context_dict);
}
Py_XINCREF(context_dict); /* so we done loose it */ Py_XINCREF(context_dict); /* so we done loose it */
if (WM_operator_poll_context((bContext *)C, ot, context) == false) { if (WM_operator_poll_context((bContext *)C, ot, context) == false) {

View File

@@ -387,6 +387,18 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
CTX_wm_window_set(C, NULL); CTX_wm_window_set(C, NULL);
} }
static void wm_event_execute_timers(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
/* Set the first window as context, so that there is some minimal context. This avoids crashes
* when calling code that assumes that there is always a window in the context (which many
* operators do). */
CTX_wm_window_set(C, wm->windows.first);
BLI_timer_execute();
CTX_wm_window_set(C, NULL);
}
/* called in mainloop */ /* called in mainloop */
void wm_event_do_notifiers(bContext *C) void wm_event_do_notifiers(bContext *C)
{ {
@@ -398,7 +410,7 @@ void wm_event_do_notifiers(bContext *C)
return; return;
} }
BLI_timer_execute(); wm_event_execute_timers(C);
/* disable? - keep for now since its used for window level notifiers. */ /* disable? - keep for now since its used for window level notifiers. */
#if 1 #if 1