fixes memory issue

This commit is contained in:
Jaume Bellet 2023-11-08 07:51:58 +01:00
parent ed86f7be23
commit 9414fe8f70
1 changed files with 8 additions and 2 deletions

View File

@ -372,17 +372,22 @@ static uiBlock *wm_block_create_custom_splash(bContext *C, ARegion *region, void
static int wm_about_custom_exec(bContext *C, wmOperator *op) static int wm_about_custom_exec(bContext *C, wmOperator *op)
{ {
char menutype_str[100] = {0}; char *menutype_str = MEM_cnew_array<char>(100, __func__);
*menutype_str = '\0';
if (RNA_struct_property_is_set(op->ptr, "menutype")) { if (RNA_struct_property_is_set(op->ptr, "menutype")) {
RNA_string_get(op->ptr, "menutype", menutype_str); RNA_string_get(op->ptr, "menutype", menutype_str);
} }
UI_popup_block_invoke(C, wm_block_create_custom_splash, menutype_str, nullptr); UI_popup_block_invoke(C, wm_block_create_custom_splash, menutype_str, MEM_freeN);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
static int wm_about_custom_invoke(bContext *C, wmOperator *op , const wmEvent * /*event*/) {
return op->type->exec(C, op);
}
void WM_OT_splash_custom(wmOperatorType *ot) void WM_OT_splash_custom(wmOperatorType *ot)
{ {
PropertyRNA *prop; PropertyRNA *prop;
@ -393,6 +398,7 @@ void WM_OT_splash_custom(wmOperatorType *ot)
ot->description = "Open a splash window with some custom information"; ot->description = "Open a splash window with some custom information";
ot->exec = wm_about_custom_exec; ot->exec = wm_about_custom_exec;
ot->invoke = wm_about_custom_invoke;
ot->poll = WM_operator_winactive; ot->poll = WM_operator_winactive;
} }