diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-23 06:44:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-23 06:44:18 +0300 |
commit | 8f8ed8f5670b96c129b1d1026a70ebf8067036b3 (patch) | |
tree | bfe65c69b1d1230c84db400cf24ac3d42db082b1 /source | |
parent | 2cf930adf3e26c2431848f28fe211fdbb576a8a3 (diff) |
Fix T80028: Crash opening a file from a timer
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c72c9ce906b..6f7c074c704 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -390,6 +390,9 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C) static void wm_event_execute_timers(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); + if (UNLIKELY(wm == NULL)) { + return; + } /* 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 @@ -402,16 +405,17 @@ static void wm_event_execute_timers(bContext *C) /* called in mainloop */ void wm_event_do_notifiers(bContext *C) { - wmWindowManager *wm = CTX_wm_manager(C); wmNotifier *note, *next; wmWindow *win; + /* Run the timer before assigning 'wm' in the unlikely case a timer loads a file, see T80028. */ + wm_event_execute_timers(C); + + wmWindowManager *wm = CTX_wm_manager(C); if (wm == NULL) { return; } - wm_event_execute_timers(C); - /* disable? - keep for now since its used for window level notifiers. */ #if 1 /* cache & catch WM level notifiers, such as frame change, scene/screen set */ |