diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-05-20 12:38:23 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-05-20 12:41:09 +0300 |
commit | 11d5a1baff49dbc234cd691fa419c8b63a79da5e (patch) | |
tree | 2e3abf9fed22cad4ab92665bae60b775848f900e | |
parent | bb88485a1693751baff8a61917987323dbee654a (diff) |
Fix T64776: Multiple close file dialogs
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d91f30d6945..9cfab63f4ab 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -2925,13 +2925,15 @@ static void wm_block_file_close_save_button(uiBlock *block, wmGenericCallback *p UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT); } +static const char *close_file_dialog_name = "file_close_popup"; + static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegion *ar, void *arg1) { wmGenericCallback *post_action = (wmGenericCallback *)arg1; Main *bmain = CTX_data_main(C); uiStyle *style = UI_style_get(); - uiBlock *block = UI_block_begin(C, ar, "file_close_popup", UI_EMBOSS); + uiBlock *block = UI_block_begin(C, ar, close_file_dialog_name, UI_EMBOSS); UI_block_flag_enable( block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT); @@ -3044,8 +3046,13 @@ static void free_post_file_close_action(void *arg) void wm_close_file_dialog(bContext *C, wmGenericCallback *post_action) { - UI_popup_block_invoke( - C, block_create__close_file_dialog, post_action, free_post_file_close_action); + if (!UI_popup_block_name_exists(C, close_file_dialog_name)) { + UI_popup_block_invoke( + C, block_create__close_file_dialog, post_action, free_post_file_close_action); + } + else { + WM_generic_callback_free(post_action); + } } bool wm_file_or_image_is_modified(const bContext *C) |