diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-09 10:00:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-09 10:00:33 +0400 |
commit | 9b5a2084bc1ca8f330faeb601d2b3c65efa98f3d (patch) | |
tree | 5047c0b51307ecc6a16a3d179d2ee82e7a7ffcb6 /source/blender/editors/interface/interface_panel.c | |
parent | cecbb3498b245fbf2226c967001c4ab40b1c7b87 (diff) |
avoid having dangling panel pointers in the interface, unregistering addons could leave the interface pointing to freed memory.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9fbf2fe8898..bcd49551784 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -306,6 +306,31 @@ void uiEndPanel(uiBlock *block, int width, int height) } } +void uiPanelClearType(wmWindowManager *wm, const ARegionType *art, const PanelType *type) +{ + wmWindow *win; + for (win = wm->windows.first; win; win = win->next) { + ScrArea *sa; + for (sa = win->screen->areabase.first; sa; sa = sa->next) { + ARegion *ar; + for (ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->type == art) { + uiBlock *block, *nblock = ar->uiblocks.first; + while ((block = nblock)) { + nblock = block->next; + if (block->panel) { + if (block->panel->type == type) { + uiFreeBlock(block->evil_C, block); + BLI_remlink(&ar->uiblocks, block); + } + } + } + } + } + } + } +} + static void ui_offset_panel_block(uiBlock *block) { uiStyle *style = UI_GetStyleDraw(); |