fix for crash with toggle-drag on a popup (when the popup is closed while dragging).
This commit is contained in:
@@ -7606,6 +7606,14 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata)
|
||||
ui_popup_block_free(C, menu);
|
||||
UI_remove_popup_handlers(&CTX_wm_window(C)->modalhandlers, menu);
|
||||
|
||||
#ifdef USE_DRAG_TOGGLE
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
WM_event_free_ui_handler_all(C, &win->modalhandlers,
|
||||
ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
|
||||
if (temp.popup_func)
|
||||
temp.popup_func(C, temp.popup_arg, temp.retvalue);
|
||||
|
||||
@@ -159,6 +159,9 @@ void WM_event_remove_ui_handler(ListBase *handlers,
|
||||
void (*remove)(struct bContext *C, void *userdata),
|
||||
void *userdata, const bool postpone);
|
||||
void WM_event_remove_area_handler(struct ListBase *handlers, void *area);
|
||||
void WM_event_free_ui_handler_all(struct bContext *C, ListBase *handlers,
|
||||
int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
|
||||
void (*remove)(struct bContext *C, void *userdata));
|
||||
|
||||
struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
|
||||
void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
|
||||
|
||||
@@ -2476,6 +2476,21 @@ void WM_event_remove_ui_handler(ListBase *handlers,
|
||||
}
|
||||
}
|
||||
|
||||
void WM_event_free_ui_handler_all(bContext *C, ListBase *handlers,
|
||||
wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove)
|
||||
{
|
||||
wmEventHandler *handler, *handler_next;
|
||||
|
||||
for (handler = handlers->first; handler; handler = handler_next) {
|
||||
handler_next = handler->next;
|
||||
if (handler->ui_handle == func && handler->ui_remove == remove) {
|
||||
remove(C, handler->ui_userdata);
|
||||
BLI_remlink(handlers, handler);
|
||||
wm_event_free_handler(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
|
||||
{
|
||||
wmEventHandler *handler;
|
||||
|
||||
Reference in New Issue
Block a user