diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-11-09 01:51:30 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-11-09 01:54:36 +0300 |
commit | ffe76ae9f4abe2a64d4c749623b99f70b3746d87 (patch) | |
tree | c62e41d9d4029525a3b834f1744d5c4f79b42b07 /source | |
parent | 206c94fea98d44ed9667607638c455c7c0e63822 (diff) |
Fix crash when loading pre 2.5 files.
Versioning code involving WM wouldn't run then (WM was just introduced
in 2.5).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 1045b2343c4..06916c48df7 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -246,13 +246,18 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist) if (BLI_listbase_is_empty(&G.main->wm)) { bScreen *screen = NULL; - /* when loading without UI, no matching needed */ - if (!(G.fileflags & G_FILE_NO_UI) && (screen = CTX_wm_screen(C))) { + /* match oldwm to new dbase, only old files */ + for (wm = oldwmlist->first; wm; wm = wm->id.next) { + wm->initialized &= ~WM_INIT_WINDOW; - /* match oldwm to new dbase, only old files */ - for (wm = oldwmlist->first; wm; wm = wm->id.next) { + /* when loading without UI, no matching needed */ + if (!(G.fileflags & G_FILE_NO_UI) && (screen = CTX_wm_screen(C))) { for (win = wm->windows.first; win; win = win->next) { - WorkSpace *workspace = WM_window_get_active_workspace(win); + WorkSpace *workspace; + + BKE_workspace_layout_find_global(G.main, screen, &workspace); + BKE_workspace_active_set(win->workspace_hook, workspace); + win->scene = CTX_data_scene(C); /* all windows get active screen from file */ if (screen->winid == 0) { @@ -271,11 +276,8 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist) } } } - + G.main->wm = *oldwmlist; - - /* screens were read from file! */ - ED_screens_initialize(G.main->wm.first); } else { bool has_match = false; |