Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_files.c
| Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | |||||
| * we try to prepare for worst case: | * we try to prepare for worst case: | ||||
| * - active window gets active screen from file | * - active window gets active screen from file | ||||
| * - restoring the screens from non-active windows | * - restoring the screens from non-active windows | ||||
| * Best case is all screens match, in that case they get assigned to proper window. | * Best case is all screens match, in that case they get assigned to proper window. | ||||
| */ | */ | ||||
| static void wm_window_match_init(bContext *C, ListBase *wmlist) | static void wm_window_match_init(bContext *C, ListBase *wmlist) | ||||
| { | { | ||||
| *wmlist = G_MAIN->wm; | *wmlist = G_MAIN->wm; | ||||
| BLI_listbase_clear(&G_MAIN->wm); | |||||
| wmWindow *active_win = CTX_wm_window(C); | wmWindow *active_win = CTX_wm_window(C); | ||||
| /* first wrap up running stuff */ | /* first wrap up running stuff */ | ||||
| /* code copied from wm_init_exit.c */ | /* code copied from wm_init_exit.c */ | ||||
| LISTBASE_FOREACH (wmWindowManager *, wm, wmlist) { | LISTBASE_FOREACH (wmWindowManager *, wm, wmlist) { | ||||
| WM_jobs_kill_all(wm); | WM_jobs_kill_all(wm); | ||||
| Show All 10 Lines | LISTBASE_FOREACH (wmWindowManager *, wm, wmlist) { | ||||
| * which can re-register subscribers on file-load. To support this use case, | * which can re-register subscribers on file-load. To support this use case, | ||||
| * it's best to have predictable behavior - always clear. */ | * it's best to have predictable behavior - always clear. */ | ||||
| if (wm->message_bus != NULL) { | if (wm->message_bus != NULL) { | ||||
| WM_msgbus_destroy(wm->message_bus); | WM_msgbus_destroy(wm->message_bus); | ||||
| wm->message_bus = NULL; | wm->message_bus = NULL; | ||||
| } | } | ||||
| } | } | ||||
| BLI_listbase_clear(&G_MAIN->wm); | |||||
| /* reset active window */ | /* reset active window */ | ||||
| CTX_wm_window_set(C, active_win); | CTX_wm_window_set(C, active_win); | ||||
| /* XXX Hack! We have to clear context menu here, because removing all modalhandlers | /* XXX Hack! We have to clear context menu here, because removing all modalhandlers | ||||
| * above frees the active menu (at least, in the 'startup splash' case), | * above frees the active menu (at least, in the 'startup splash' case), | ||||
| * causing use-after-free error in later handling of the button callbacks in UI code | * causing use-after-free error in later handling of the button callbacks in UI code | ||||
| * (see ui_apply_but_funcs_after()). | * (see ui_apply_but_funcs_after()). | ||||
| * Tried solving this by always NULL-ing context's menu when setting wm/win/etc., | * Tried solving this by always NULL-ing context's menu when setting wm/win/etc., | ||||
| ▲ Show 20 Lines • Show All 3,584 Lines • Show Last 20 Lines | |||||