From 16377abda8adb6444e888d1144d9225fa6415e65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 25 Aug 2017 20:26:52 +1000 Subject: WM: initialize WM and deps before handling events This avoids obscure bugs where operators could run from events that happen before the UI and depsgraph have been initialized. See: D2809 for details. --- source/blender/windowmanager/intern/wm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/windowmanager/intern/wm.c') diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 1738dabde2d..a09cc4aeb31 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -495,6 +495,10 @@ void wm_close_and_free_all(bContext *C, ListBase *wmlist) void WM_main(bContext *C) { + /* Single refresh before handling events. + * This ensures we don't run operators before the depsgraph has been evaluated. */ + wm_event_do_refresh_wm_and_depsgraph(C); + while (1) { /* get events from ghost, handle window events, add to window queues */ -- cgit v1.2.3