Fix #127582: Crash when clicking onto particle settings button

This is due to memory allocation mismatch. `MEM_dupallocN` is used on
cpp style `ButsTextureUser` pointer. Now fixed by using `MEM_new`. Also
pass `uiButArgNFree/Copy` callback fn arguments to avoid the use of
default arguments which are C style.

Pull Request: https://projects.blender.org/blender/blender/pulls/127690
This commit is contained in:
Pratik Borhade
2024-09-18 13:32:06 +02:00
committed by Pratik Borhade
parent 92544d6d76
commit ac66069eff

View File

@@ -515,7 +515,12 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void * /*a
0.0,
0.0,
"");
UI_but_funcN_set(but, template_texture_select, MEM_dupallocN(user), nullptr);
UI_but_funcN_set(but,
template_texture_select,
MEM_new<ButsTextureUser>("ButsTextureUser", *user),
nullptr,
but_func_argN_free<ButsTextureUser>,
but_func_argN_copy<ButsTextureUser>);
last_category = user->category;
}