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/windowmanager/gizmo/intern/wm_gizmo_type.c
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/windowmanager/gizmo/intern/wm_gizmo_type.c')
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
index 185854b1ca0..1523246d08b 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
@@ -121,7 +121,7 @@ void WM_gizmotype_append_ptr(void (*gtfunc)(struct wmGizmoType *, void *), void
/**
* Free but don't remove from ghash.
*/
-static void gizmotype_free(wmGizmoType *gzt)
+void WM_gizmotype_free_ptr(wmGizmoType *gzt)
{
if (gzt->rna_ext.srna) { /* python gizmo, allocs own string */
MEM_freeN((void *)gzt->idname);
@@ -169,8 +169,6 @@ void WM_gizmotype_remove_ptr(bContext *C, Main *bmain, wmGizmoType *gzt)
BLI_ghash_remove(global_gizmotype_hash, gzt->idname, NULL, NULL);
gizmotype_unlink(C, bmain, gzt);
-
- gizmotype_free(gzt);
}
bool WM_gizmotype_remove(bContext *C, Main *bmain, const char *idname)
@@ -186,9 +184,9 @@ bool WM_gizmotype_remove(bContext *C, Main *bmain, const char *idname)
return true;
}
-static void wm_gizmotype_ghash_free_cb(wmGizmoType *mt)
+static void wm_gizmotype_ghash_free_cb(wmGizmoType *gzt)
{
- gizmotype_free(mt);
+ WM_gizmotype_free_ptr(gzt);
}
void wm_gizmotype_free(void)