[Bf-blender-cvs] [40272b4] workspaces: Fix crashes when opening new windows

Julian Eisel noreply at git.blender.org
Wed Dec 21 03:53:13 CET 2016


Commit: 40272b43c04080c1428c8c91d35cd055d4e0c6ab
Author: Julian Eisel
Date:   Wed Dec 21 03:52:44 2016 +0100
Branches: workspaces
https://developer.blender.org/rB40272b43c04080c1428c8c91d35cd055d4e0c6ab

Fix crashes when opening new windows

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

M	source/blender/editors/screen/screen_ops.c
M	source/blender/windowmanager/intern/wm_window.c

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

diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 5482b38..74222a9 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -980,12 +980,14 @@ static void SCREEN_OT_area_swap(wmOperatorType *ot)
 static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	wmWindow *newwin, *win;
+	Scene *scene;
 	WorkSpaceLayout *layout_new;
 	bScreen *newsc, *sc;
 	ScrArea *sa;
 	rcti rect;
 	
 	win = CTX_wm_window(C);
+	scene = CTX_data_scene(C);
 	sc = CTX_wm_screen(C);
 	sa = CTX_wm_area(C);
 	
@@ -1013,7 +1015,8 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
 	*newwin->stereo3d_format = *win->stereo3d_format;
 
-	newwin->workspace = win->workspace;
+	newwin->scene = scene;
+	newwin->workspace = BKE_workspace_add(CTX_data_main(C), BKE_workspace_name_get(win->workspace));
 	/* allocs new screen and adds to newly created window, using window size */
 	layout_new = ED_workspace_layout_add(newwin->workspace, newwin, sc->id.name + 2);
 	newsc = BKE_workspace_layout_screen_get(layout_new);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index d6ed27ea..40741ad 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -252,6 +252,7 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
 {
 	Main *bmain = CTX_data_main(C);
 	wmWindow *win_dst = wm_window_new(C);
+	Scene *scene = WM_window_get_active_scene(win_src);
 	bScreen *new_screen;
 
 	win_dst->posx = win_src->posx + 10;
@@ -259,6 +260,7 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
 	win_dst->sizex = win_src->sizex;
 	win_dst->sizey = win_src->sizey;
 
+	win_dst->scene = scene;
 	win_dst->workspace = ED_workspace_duplicate(win_src->workspace, bmain, win_dst);
 	new_screen = WM_window_get_active_screen(win_dst);
 	BLI_strncpy(win_dst->screenname, new_screen->id.name + 2, sizeof(win_dst->screenname));
@@ -669,11 +671,9 @@ wmWindow *WM_window_open_temp(bContext *C, const rcti *rect_init, int type)
 		screen = BKE_workspace_layout_screen_get(layout);
 		WM_window_set_active_layout(win, layout);
 	}
-	else {
-		/* switch scene for rendering */
-		if (WM_window_get_active_scene(win) != scene) {
-			WM_window_set_active_scene(bmain, C, win, scene);
-		}
+
+	if (WM_window_get_active_scene(win) != scene) {
+		WM_window_set_active_scene(bmain, C, win, scene);
 	}
 
 	screen->temp = 1;




More information about the Bf-blender-cvs mailing list