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:
authorCampbell Barton <ideasman42@gmail.com>2021-04-24 16:31:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-04-24 16:37:32 +0300
commit0f1ee611d4499fbac050b7a997e50bc234a252f9 (patch)
tree0cea65bf1f560715857a784d24ba1839cfde1167 /source/blender/makesrna
parentaa95f8019e4204ea50210add1b2c2ed1934b92c9 (diff)
Fix T85567: Crash accessing gizmo group on `__del__`
- Re-order freeing so an instances __del__ method runs before the `ExtensionRNA` has been freed. - "remove" functions no longer free the gizmo/gizmo-group memory, needed so the identifier used when freeing the extension doesn't use the freed identifier.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index f7d139dd706..e91df38c96e 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -534,12 +534,16 @@ static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
return;
}
+ WM_gizmotype_remove_ptr(NULL, bmain, gzt);
+
+ /* Free extension after removing instances so `__del__` doesn't crash, see: T85567. */
RNA_struct_free_extension(type, &gzt->rna_ext);
RNA_struct_free(&BLENDER_RNA, type);
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+ /* Free gizmo group after the extension as it owns the identifier memory. */
+ WM_gizmotype_free_ptr(gzt);
- WM_gizmotype_remove_ptr(NULL, bmain, gzt);
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
}
static void **rna_Gizmo_instance(PointerRNA *ptr)
@@ -934,12 +938,16 @@ static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
return;
}
+ WM_gizmo_group_type_remove_ptr(bmain, gzgt);
+
+ /* Free extension after removing instances so `__del__` doesn't crash, see: T85567. */
RNA_struct_free_extension(type, &gzgt->rna_ext);
RNA_struct_free(&BLENDER_RNA, type);
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+ /* Free gizmo group after the extension as it owns the identifier memory. */
+ WM_gizmo_group_type_free_ptr(gzgt);
- WM_gizmo_group_type_remove_ptr(bmain, gzgt);
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
}
static void **rna_GizmoGroup_instance(PointerRNA *ptr)