[Bf-blender-cvs] [ffe76ae9f4a] blender2.8: Fix crash when loading pre 2.5 files.

Julian Eisel noreply at git.blender.org
Wed Nov 8 23:55:02 CET 2017


Commit: ffe76ae9f4abe2a64d4c749623b99f70b3746d87
Author: Julian Eisel
Date:   Wed Nov 8 23:51:30 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBffe76ae9f4abe2a64d4c749623b99f70b3746d87

Fix crash when loading pre 2.5 files.

Versioning code involving WM wouldn't run then (WM was just introduced
in 2.5).

===================================================================

M	source/blender/windowmanager/intern/wm_files.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list