Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-12-02 07:46:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-12-02 07:53:41 +0300
commit8f69c914080a7fe9555f7126362f08c368a8069d (patch)
treea6677403e53ee2a6334e3a3dae9a5bcd8baff6e7 /source/blender/editors/interface/interface_handlers.c
parent0de1d2e84efe5fb085847328e891fbf0f3f17b4f (diff)
Fix T93410: Crash hiding a region from Python used by a popover
Close all active buttons when hiding a region as this can be called from Python a popover is open from that region. Failure to do this causes the popover to read from the freed button. Also rename UI_screen_free_active_but to UI_screen_free_active_but_highlight since it only frees highlighted buttons.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index fe540c3624c..14df5ec68ac 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -439,11 +439,11 @@ typedef struct uiHandleButtonData {
float ungrab_mval[2];
#endif
- /* menu open (watch UI_screen_free_active_but) */
+ /* Menu open, see: #UI_screen_free_active_but_highlight. */
uiPopupBlockHandle *menu;
int menuretval;
- /* search box (watch UI_screen_free_active_but) */
+ /* Search box see: #UI_screen_free_active_but_highlight. */
ARegion *searchbox;
#ifdef USE_KEYNAV_LIMIT
struct uiKeyNavLock searchbox_keynav_state;
@@ -11674,8 +11674,20 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
/** \name Public Utilities
* \{ */
+void UI_region_free_active_but_all(bContext *C, ARegion *region)
+{
+ LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
+ LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
+ if (but->active == NULL) {
+ continue;
+ }
+ ui_but_active_free(C, but);
+ }
+ }
+}
+
/* is called by notifier */
-void UI_screen_free_active_but(const bContext *C, bScreen *screen)
+void UI_screen_free_active_but_highlight(const bContext *C, bScreen *screen)
{
wmWindow *win = CTX_wm_window(C);