[Bf-blender-cvs] [867f96c2341] blender2.8: Fix crash and invalid context when changing workspace
Julian Eisel
noreply at git.blender.org
Mon Apr 9 13:19:26 CEST 2018
Commit: 867f96c23419269452488ecf80f908c57a84f935
Author: Julian Eisel
Date: Mon Apr 9 13:11:24 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB867f96c23419269452488ecf80f908c57a84f935
Fix crash and invalid context when changing workspace
Caused by 1c24c04e6023f2d2a3.
===================================================================
M source/blender/editors/screen/screen_context.c
M source/blender/editors/screen/workspace_edit.c
===================================================================
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index e0c73b1782e..98a6670d10f 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -93,7 +93,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
Object *obact = (view_layer && view_layer->basact) ? view_layer->basact->object : NULL;
- Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ Object *obedit = view_layer ? OBEDIT_FROM_VIEW_LAYER(view_layer) : NULL;
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, screen_context_dir);
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index dee62f9c5dd..fbfb88ce6c1 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -193,7 +193,9 @@ bool ED_workspace_change(
WM_window_set_active_layout(win, workspace_new, layout_new);
WM_window_set_active_workspace(win, workspace_new);
- /* update screen *after* changing workspace - which also causes the actual screen change */
+ /* update screen *after* changing workspace - which also causes the
+ * actual screen change and updates context (including CTX_wm_workspace) */
+ screen_change_update(C, win, screen_new);
workspace_change_update(workspace_new, workspace_old, C, wm);
BLI_assert(BKE_workspace_view_layer_get(workspace_new, CTX_data_scene(C)) != NULL);
More information about the Bf-blender-cvs
mailing list