From 4c4a8bf588c52e05f868a89938fa09e6f25ba1d8 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Sep 2019 00:13:24 +0200 Subject: Fix T69498: Crash on export UV Layout Ensure there's a drawable context after the file browser window is destroyed. --- source/blender/windowmanager/intern/wm_event_system.c | 8 ++++++-- source/blender/windowmanager/intern/wm_files.c | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 440dd6cd557..32324745bc4 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2376,6 +2376,8 @@ static int wm_handler_fileselect_do(bContext *C, case EVT_FILESELECT_EXEC: case EVT_FILESELECT_CANCEL: case EVT_FILESELECT_EXTERNAL_CANCEL: { + wmWindow *ctx_win = CTX_wm_window(C); + /* remlink now, for load file case before removing*/ BLI_remlink(handlers, handler); @@ -2388,11 +2390,13 @@ static int wm_handler_fileselect_do(bContext *C, BLI_assert(file_sa->spacetype == SPACE_FILE); if (BLI_listbase_is_single(&file_sa->spacedata)) { - wmWindow *ctx_win = CTX_wm_window(C); BLI_assert(ctx_win != win); wm_window_close(C, wm, win); + CTX_wm_window_set(C, ctx_win); // wm_window_close() NULLs. + /* Some operators expect a drawable context (for EVT_FILESELECT_EXEC) */ + wm_window_make_drawable(wm, ctx_win); } else if (file_sa->full) { ED_screen_full_prevspace(C, file_sa); @@ -2406,7 +2410,7 @@ static int wm_handler_fileselect_do(bContext *C, } } - wm_handler_op_context(C, handler, CTX_wm_window(C)->eventstate); + wm_handler_op_context(C, handler, ctx_win->eventstate); /* needed for UI_popup_menu_reports */ diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c7f38a7f53b..2b89426f083 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1240,9 +1240,6 @@ static ImBuf *blend_file_thumb(const bContext *C, /* gets scaled to BLEN_THUMB_SIZE */ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - /* Offscreen drawing requires a drawable window context. */ - wm_window_make_drawable(wm, CTX_wm_window(C)); - if (scene->camera) { ibuf = ED_view3d_draw_offscreen_imbuf_simple(depsgraph, scene, -- cgit v1.2.3