Proper fix for User Preferences window crash

Reverts rBb9ae517794765d6a1660 and fixes the issue properly. Old fix could cause
NULL to be passed to functions that expect all arguments to be non-NULL.
This commit is contained in:
Julian Eisel 2018-03-07 21:18:16 +01:00
parent c00b42b710
commit 8851460174
2 changed files with 6 additions and 2 deletions

View File

@ -134,7 +134,7 @@ void ED_scene_change_update(
CTX_data_eval_ctx(C, &eval_ctx_old);
eObjectMode object_mode_old = workspace->object_mode;
ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace);
Object *obact_old = layer_old ? OBACT(layer_old) : NULL;
Object *obact_old = OBACT(layer_old);
bool obact_new_mode_exists = ED_object_mode_generic_exists(bmain->wm.first, obact_new, workspace->object_mode);

View File

@ -766,7 +766,11 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
WM_window_set_active_layout(win, workspace, layout);
}
if (WM_window_get_active_scene(win) != scene) {
if (win->scene == NULL) {
win->scene = scene;
}
/* In case we reuse an already existing temp window (see win lookup above). */
else if (WM_window_get_active_scene(win) != scene) {
WM_window_change_active_scene(bmain, C, win, scene);
}