Fix use of uninitialized stack memory when registering a Macro

The draw callback could be assigned even when it's not in the Python
class.
This commit is contained in:
Campbell Barton
2024-05-31 15:26:39 +10:00
parent 494686b29f
commit e771ea3d98

View File

@@ -1733,7 +1733,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
const char *error_prefix = "Registering operator macro class:";
wmOperatorType dummy_ot = {nullptr};
wmOperator dummy_operator = {nullptr};
bool have_function[4];
bool have_function[2];
struct {
char idname[OP_MAX_TYPENAME];
@@ -1837,7 +1837,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
dummy_ot.rna_ext.free = free;
dummy_ot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : nullptr;
dummy_ot.ui = (have_function[3]) ? rna_operator_draw_cb : nullptr;
dummy_ot.ui = (have_function[1]) ? rna_operator_draw_cb : nullptr;
WM_operatortype_append_macro_ptr(BPY_RNA_operator_macro_wrapper, (void *)&dummy_ot);