Fix passing allocated strings to guarded-alloc

This commit is contained in:
Campbell Barton
2024-06-02 20:39:06 +10:00
parent 1aa5eddab3
commit cfd199b7a2
2 changed files with 4 additions and 3 deletions

View File

@@ -2977,7 +2977,7 @@ static wmOperator *minimal_operator_create(wmOperatorType *ot, PointerRNA *prope
{
/* Copied from #wm_operator_create.
* Create a slimmed down operator suitable only for UI drawing. */
wmOperator *op = MEM_cnew<wmOperator>(ot->idname);
wmOperator *op = MEM_cnew<wmOperator>(ot->rna_ext.srna ? __func__ : ot->idname);
STRNCPY(op->idname, ot->idname);
op->type = ot;

View File

@@ -1394,8 +1394,9 @@ static wmOperator *wm_operator_create(wmWindowManager *wm,
PointerRNA *properties,
ReportList *reports)
{
/* Operator-type names are static still. pass to allocation name for debugging. */
wmOperator *op = MEM_cnew<wmOperator>(ot->idname);
/* Operator-type names are static still (for C++ defined operators).
* Pass to allocation name for debugging. */
wmOperator *op = MEM_cnew<wmOperator>(ot->rna_ext.srna ? __func__ : ot->idname);
/* Adding new operator could be function, only happens here now. */
op->type = ot;