Completely move freeing flag to report, operator flag is uneeded.
Also bugfix for py operators. Reports need to be kept alive when operator is registered.
This commit is contained in:
@@ -298,7 +298,6 @@ typedef struct wmOperator {
|
||||
#define OPERATOR_PASS_THROUGH 8
|
||||
|
||||
/* wmOperator flag */
|
||||
#define OPERATOR_REPORT_FREE 1
|
||||
|
||||
|
||||
/* ************** wmEvent ************************ */
|
||||
|
||||
@@ -69,7 +69,7 @@ void WM_operator_free(wmOperator *op)
|
||||
MEM_freeN(op->properties);
|
||||
}
|
||||
|
||||
if(op->reports && ((op->flag & OPERATOR_REPORT_FREE) || (op->reports->flag & RPT_FREE))) {
|
||||
if(op->reports && (op->reports->flag & RPT_FREE)) {
|
||||
BKE_reports_clear(op->reports);
|
||||
MEM_freeN(op->reports);
|
||||
}
|
||||
|
||||
@@ -349,8 +349,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
|
||||
}
|
||||
else {
|
||||
op->reports= MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
|
||||
BKE_reports_init(op->reports, RPT_STORE);
|
||||
op->flag |= OPERATOR_REPORT_FREE;
|
||||
BKE_reports_init(op->reports, RPT_STORE|RPT_FREE);
|
||||
}
|
||||
|
||||
/* recursive filling of operator macro list */
|
||||
@@ -555,7 +554,8 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA
|
||||
|
||||
retval= wm_operator_call_internal(C, ot, context, properties, reports);
|
||||
|
||||
if (retval & OPERATOR_RUNNING_MODAL)
|
||||
/* keep the reports around if needed later */
|
||||
if (retval & OPERATOR_RUNNING_MODAL || ot->flag & OPTYPE_REGISTER)
|
||||
{
|
||||
reports->flag |= RPT_FREE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user