[Bf-blender-cvs] [6bf89078630] workspaces: Fix crash opening startup.blend as regular .blend
Julian Eisel
noreply at git.blender.org
Thu Apr 6 15:34:08 CEST 2017
Commit: 6bf890786305fed0c07b526059580d980796a7cc
Author: Julian Eisel
Date: Thu Apr 6 15:32:14 2017 +0200
Branches: workspaces
https://developer.blender.org/rB6bf890786305fed0c07b526059580d980796a7cc
Fix crash opening startup.blend as regular .blend
Also fixed incorrect context change.
===================================================================
M source/blender/blenkernel/intern/context.c
M source/blender/editors/screen/workspace_edit.c
M source/blender/windowmanager/intern/wm_files.c
===================================================================
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 0318c62d6c8..65ee70d8aba 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -834,9 +834,7 @@ void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
void CTX_wm_window_set(bContext *C, wmWindow *win)
{
C->wm.window = win;
- if (C->wm.window) {
- C->data.scene = C->wm.window->scene;
- }
+ C->data.scene = (win) ? win->scene : NULL;
C->wm.workspace = (win) ? BKE_workspace_active_get(win->workspace_hook) : NULL;
C->wm.screen = (win) ? BKE_workspace_active_screen_get(win->workspace_hook) : NULL;
C->wm.area = NULL;
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index b3513966e59..37812e97c3a 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -364,11 +364,9 @@ static void workspace_workflow_file_append_buttons(
static int workspace_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
const Main *bmain = CTX_data_main(C);
- uiPopupMenu *pup;
- uiLayout *layout;
- pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE);
- layout = UI_popup_menu_layout(pup);
+ uiPopupMenu *pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE);
+ uiLayout *layout = UI_popup_menu_layout(pup);
uiItemO(layout, "Duplicate Current", ICON_NONE, "WORKSPACE_OT_workspace_duplicate");
uiItemS(layout);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 61987246e1b..aaac2994054 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -586,6 +586,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* match the read WM with current WM */
wm_window_match_do(C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
+ wm_file_read_post(C, false); /* do before wm_init_usedef to ensure updated context */
if (retval == BKE_BLENDFILE_READ_OK_USERPREFS) {
/* in case a userdef is read from regular .blend */
@@ -598,8 +599,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
}
}
- wm_file_read_post(C, false);
-
success = true;
}
#if 0
More information about the Bf-blender-cvs
mailing list