From 75ef51cc80c6906bf6a5ba484ae4be8ce1550ddc Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 31 May 2022 12:03:33 +0200 Subject: 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. --- source/blender/editors/interface/interface.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to '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... */ } -- cgit v1.2.3