[Bf-blender-cvs] [75ef51cc80c] blender-v3.2-release: Fix T95394: Crash when dragging from location of just cleared asset

Julian Eisel noreply at git.blender.org
Tue May 31 12:29:22 CEST 2022


Commit: 75ef51cc80c6906bf6a5ba484ae4be8ce1550ddc
Author: Julian Eisel
Date:   Tue May 31 12:03:33 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB75ef51cc80c6906bf6a5ba484ae4be8ce1550ddc

Fix T95394: Crash when dragging from location of just cleared asset

In Blender buttons are recreated over redraws, except of the active
button which is kept alive, and replaces the new version of itself in
the new redraw. In order to do that, the button needs to be recognized.
This process of recognizing and matching buttons from different redraws
isn't always bullet-proof. That's okay-ish, but we have to make sure
that the relevant data of the old active button is updated with the
newest data.

Here the matching would go wrong, and the new active button was
recognized as the old active button, which was in fact removed when the
asset was cleared. This patch makes sure the image buffer attached to
the buttons is updated when buttons were recognized as matching.

Note that the dragging will still use the wrong data-block, this will be
fixed in the following commit.

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

M	source/blender/editors/interface/interface.cc

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

diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc
index 480044118f1..ffd9ab86ee3 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -930,6 +930,9 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
   if (but->dragpoin && (but->dragflag & UI_BUT_DRAGPOIN_FREE)) {
     SWAP(void *, but->dragpoin, oldbut->dragpoin);
   }
+  if (but->imb) {
+    SWAP(ImBuf *, but->imb, oldbut->imb);
+  }
 
   /* NOTE: if layout hasn't been applied yet, it uses old button pointers... */
 }



More information about the Bf-blender-cvs mailing list