Fix T49034: multi-drag crashes when UI forces exit

This commit is contained in:
Campbell Barton 2017-07-11 19:07:37 +10:00
parent 218c254e72
commit d415a1cbd6
Notes: blender-bot 2023-02-14 07:42:07 +01:00
Referenced by issue #49034, Crash when trying to adjust Frame in Graph Editor
1 changed files with 11 additions and 0 deletions

View File

@ -380,6 +380,17 @@ uiButStore *UI_butstore_create(uiBlock *block)
void UI_butstore_free(uiBlock *block, uiButStore *bs_handle)
{
/* Workaround for button store being moved into new block,
* which then can't use the previous buttons state ('ui_but_update_from_old_block' fails to find a match),
* keeping the active button in the old block holding a reference to the button-state in the new block: see T49034.
*
* Ideally we would manage moving the 'uiButStore', keeping a correct state.
* All things considered this is the most straightforward fix - Campbell.
*/
if (block != bs_handle->block && bs_handle->block != NULL) {
block = bs_handle->block;
}
BLI_freelistN(&bs_handle->items);
BLI_remlink(&block->butstore, bs_handle);