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:
authorDalai Felinto <dfelinto@gmail.com>2019-06-21 19:19:16 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-06-25 20:10:31 +0300
commita6d2f9ffd0d8a8d7d973a320c978d9914615855e (patch)
treea695f19e3448ad1f5ef968fa4a9dc121093b9be2 /source/blender/makesrna/intern/rna_ui.c
parent367cd72b230523b9f2bcd40040689600db48df95 (diff)
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
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui.c19
1 files changed, 18 insertions, 1 deletions
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);
}