Fix T80854: Search buttons fail in Adjust Last Operation Panel
There's the old and ugly hack where the `uiBut.poin` points to the button itself. When reallocating the button we have to update that pointer of course.
This commit is contained in:
parent
87d2ac9681
commit
7883ccd29f
Notes:
blender-bot
2023-02-14 10:29:32 +01:00
Referenced by issue #80854, Search buttons with pointer properties fail in Adjust Last Operation Panel (e.g. cannot change ShapeKey on Blend From Shape operator)
|
@ -3988,12 +3988,16 @@ uiBut *ui_but_change_type(uiBut *but, eButType new_type)
|
|||
const void *old_but_ptr = but;
|
||||
/* Button may have pointer to a member within itself, this will have to be updated. */
|
||||
const bool has_str_ptr_to_self = but->str == but->strdata;
|
||||
const bool has_poin_ptr_to_self = but->poin == (char *)but;
|
||||
|
||||
but = MEM_recallocN_id(but, alloc_size, alloc_str);
|
||||
but->type = new_type;
|
||||
if (has_str_ptr_to_self) {
|
||||
but->str = but->strdata;
|
||||
}
|
||||
if (has_poin_ptr_to_self) {
|
||||
but->poin = (char *)but;
|
||||
}
|
||||
|
||||
BLI_insertlinkafter(&but->block->buttons, insert_after_but, but);
|
||||
|
||||
|
|
Loading…
Reference in New Issue