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:
authorHans Goudey <h.goudey@me.com>2020-06-15 16:06:54 +0300
committerHans Goudey <h.goudey@me.com>2020-06-15 16:06:54 +0300
commitec25084f5a404cbca4ceffd659d46b21c758522a (patch)
treea0cda3acd0f21127b6f0e1ce0648e2f5a27775b8 /source/blender/editors/interface/interface_panel.c
parenteadbdf170aeccba498fd9c0e7ef879f2a9f71bd0 (diff)
Fix T77541: Unregistering DATA_PT_modifiers doesn't remove modifier panels
This is a pretty quick fix; the solution is just removing all the instanced panels whena panel is unregistered. This also necessitates adding the option to call UI_panels_free_instanced with NULL context. Differential Revision: https://developer.blender.org/D7977
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 5f56a93c5eb..2b8e7cdb2e7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -354,13 +354,19 @@ static void panel_delete(ARegion *region, ListBase *panels, Panel *panel)
MEM_freeN(panel);
}
+/**
+ * Remove instanced panels from the region's panel list.
+ *
+ * \note Can be called with NULL \a C, but it should be avoided because
+ * handlers might not be removed.
+ */
void UI_panels_free_instanced(bContext *C, ARegion *region)
{
/* Delete panels with the instanced flag. */
LISTBASE_FOREACH_MUTABLE (Panel *, panel, &region->panels) {
if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) {
/* Make sure the panel's handler is removed before deleting it. */
- if (panel->activedata != NULL) {
+ if (C != NULL && panel->activedata != NULL) {
panel_activate_state(C, panel, PANEL_STATE_EXIT);
}
panel_delete(region, &region->panels, panel);