diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-17 17:54:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-17 17:54:44 +0400 |
commit | ebda20150d46cdcb161898b1393b9a8dce352e89 (patch) | |
tree | 2defbd541725b75a3223c7110d75fc0170cc353d /source/blender/windowmanager | |
parent | e2f58d817a9012b4642b96ef9cff26ed906dd62d (diff) |
fix for crash with toggle-drag on a popup (when the popup is closed while dragging).
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 585201bc559..9830dcb9e9f 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -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); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 89dc6ccc038..03a1785541e 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -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; |