diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-14 16:38:24 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-14 16:38:24 +0300 |
commit | 3c14eba0450cc5852ef5332ceaa75c2ba72b42c3 (patch) | |
tree | f0b0894f4ce5501b9717342ea00fd6e1885a43bb /source/blender | |
parent | 914a0aa8f474a9991f34c7dc40c2ea85b4d936ed (diff) |
UI: fix for delayed UI callback functions, to avoid it being
called recursively.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 30a88d7c045..144e8490661 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -189,8 +189,13 @@ static void ui_apply_but_func(bContext *C, uiBut *but) static void ui_apply_but_funcs_after(bContext *C) { uiAfterFunc *after; + ListBase funcs; - for(after=UIAfterFuncs.first; after; after=after->next) { + /* copy to avoid recursive calls */ + funcs= UIAfterFuncs; + UIAfterFuncs.first= UIAfterFuncs.last= NULL; + + for(after=funcs.first; after; after=after->next) { if(after->func) after->func(C, after->func_arg1, after->func_arg2); @@ -200,7 +205,7 @@ static void ui_apply_but_funcs_after(bContext *C) after->butm_func(C, after->butm_func_arg, after->a2); } - BLI_freelistN(&UIAfterFuncs); + BLI_freelistN(&funcs); } static void ui_apply_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data) |