[Bf-blender-cvs] [11d5a1baff4] master: Fix T64776: Multiple close file dialogs

Jacques Lucke noreply at git.blender.org
Mon May 20 11:41:49 CEST 2019


Commit: 11d5a1baff49dbc234cd691fa419c8b63a79da5e
Author: Jacques Lucke
Date:   Mon May 20 11:38:23 2019 +0200
Branches: master
https://developer.blender.org/rB11d5a1baff49dbc234cd691fa419c8b63a79da5e

Fix T64776: Multiple close file dialogs

===================================================================

M	source/blender/windowmanager/intern/wm_files.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list