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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ extern const PointerRNA PointerRNA_NULL;
|
||||
|
||||
struct PropertyPointerRNA {
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
PropertyRNA *prop = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user