Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-05-31 13:03:33 +0300
committerJulian Eisel <julian@blender.org>2022-05-31 13:27:52 +0300
commit75ef51cc80c6906bf6a5ba484ae4be8ce1550ddc (patch)
tree564bda65f364f5a3c5efed4e4b342e2c57b16c30 /source/blender/editors/interface/interface.cc
parent344a8fb3d4ec4a7cf04aad328e08cc7f490c99d9 (diff)
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.
Diffstat (limited to 'source/blender/editors/interface/interface.cc')
-rw-r--r--source/blender/editors/interface/interface.cc3
1 files changed, 3 insertions, 0 deletions
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... */
}