[Bf-blender-cvs] [7883ccd29fe] master: Fix T80854: Search buttons fail in Adjust Last Operation Panel

Julian Eisel noreply at git.blender.org
Mon Sep 21 15:07:57 CEST 2020


Commit: 7883ccd29fe1dc37dff6c46ee0e9ba053444466d
Author: Julian Eisel
Date:   Mon Sep 21 14:57:32 2020 +0200
Branches: master
https://developer.blender.org/rB7883ccd29fe1dc37dff6c46ee0e9ba053444466d

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.

===================================================================

M	source/blender/editors/interface/interface.c

===================================================================

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 2cb58c92449..8b149e2f97b 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -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);



More information about the Bf-blender-cvs mailing list