From c7e44734fbef239a66f82cb754a542c5f6ee10ae Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 7 Feb 2025 14:51:12 +0100 Subject: [PATCH] Fix #134228: crash when trying to open file in text editor Caused by the fact that PointerRNA is a non-trivial type now. --- source/blender/editors/sound/sound_ops.cc | 5 ++--- source/blender/editors/space_text/text_ops.cc | 5 ++--- source/blender/makesrna/RNA_types.hh | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/sound/sound_ops.cc b/source/blender/editors/sound/sound_ops.cc index 698e7c1abad..8dc9ed7c18e 100644 --- a/source/blender/editors/sound/sound_ops.cc +++ b/source/blender/editors/sound/sound_ops.cc @@ -64,8 +64,7 @@ static void sound_open_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; - op->customdata = pprop = static_cast( - MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA")); + op->customdata = pprop = MEM_new(__func__); UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); } @@ -107,7 +106,7 @@ static int sound_open_exec(bContext *C, wmOperator *op) DEG_relations_tag_update(bmain); - MEM_freeN(op->customdata); + MEM_delete(pprop); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_text/text_ops.cc b/source/blender/editors/space_text/text_ops.cc index 7cbed6bcbdd..5c3d7635b24 100644 --- a/source/blender/editors/space_text/text_ops.cc +++ b/source/blender/editors/space_text/text_ops.cc @@ -387,8 +387,7 @@ void TEXT_OT_new(wmOperatorType *ot) static void text_open_init(bContext *C, wmOperator *op) { - PropertyPointerRNA *pprop = static_cast( - MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA")); + PropertyPointerRNA *pprop = MEM_new(__func__); op->customdata = pprop; UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); @@ -442,7 +441,7 @@ static int text_open_exec(bContext *C, wmOperator *op) space_text_drawcache_tag_update(st, true); WM_event_add_notifier(C, NC_TEXT | NA_ADDED, text); - MEM_freeN(op->customdata); + MEM_delete(pprop); return OPERATOR_FINISHED; } diff --git a/source/blender/makesrna/RNA_types.hh b/source/blender/makesrna/RNA_types.hh index e0fc91d1e24..3c73d6640b3 100644 --- a/source/blender/makesrna/RNA_types.hh +++ b/source/blender/makesrna/RNA_types.hh @@ -100,7 +100,7 @@ extern const PointerRNA PointerRNA_NULL; struct PropertyPointerRNA { PointerRNA ptr; - PropertyRNA *prop; + PropertyRNA *prop = nullptr; }; /**