Fix #134228: crash when trying to open file in text editor

Caused by the fact that PointerRNA is a non-trivial type now.
This commit is contained in:
Jacques Lucke
2025-02-07 14:51:12 +01:00
parent 5fcfc57103
commit c7e44734fb
3 changed files with 5 additions and 7 deletions

View File

@@ -64,8 +64,7 @@ static void sound_open_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop;
op->customdata = pprop = static_cast<PropertyPointerRNA *>(
MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"));
op->customdata = pprop = MEM_new<PropertyPointerRNA>(__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;
}

View File

@@ -387,8 +387,7 @@ void TEXT_OT_new(wmOperatorType *ot)
static void text_open_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop = static_cast<PropertyPointerRNA *>(
MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"));
PropertyPointerRNA *pprop = MEM_new<PropertyPointerRNA>(__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;
}

View File

@@ -100,7 +100,7 @@ extern const PointerRNA PointerRNA_NULL;
struct PropertyPointerRNA {
PointerRNA ptr;
PropertyRNA *prop;
PropertyRNA *prop = nullptr;
};
/**