[Bf-blender-cvs] [a6d2f9ffd0d] master: Fix T65999: Crash when disabling an addon while its panel is visible
Dalai Felinto
noreply at git.blender.org
Tue Jun 25 19:16:32 CEST 2019
Commit: a6d2f9ffd0d8a8d7d973a320c978d9914615855e
Author: Dalai Felinto
Date: Fri Jun 21 13:19:16 2019 -0300
Branches: master
https://developer.blender.org/rBa6d2f9ffd0d8a8d7d973a320c978d9914615855e
Fix T65999: Crash when disabling an addon while its panel is visible
Note, the performance of the tests we run here is still bad since we have plenty
of panels around. But better than the crash.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5116
===================================================================
M source/blender/makesrna/intern/rna_ui.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 1e5f1dc20ec..a2339a815dc 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -180,7 +180,7 @@ static void panel_draw_header_preset(const bContext *C, Panel *pnl)
RNA_parameter_list_free(&list);
}
-static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type)
+static void rna_Panel_unregister(Main *bmain, StructRNA *type)
{
ARegionType *art;
PanelType *pt = RNA_struct_blender_type_get(type);
@@ -210,6 +210,23 @@ static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type)
BLI_freelistN(&pt->children);
BLI_freelinkN(&art->paneltypes, pt);
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ if (region->type == art) {
+ for (Panel *pa = region->panels.first; pa; pa = pa->next) {
+ if (pa->type == pt) {
+ pa->type = NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
/* update while blender is running */
WM_main_add_notifier(NC_WINDOW, NULL);
}
More information about the Bf-blender-cvs
mailing list