Fix rare crash dragging number-buttons

Could happen dragging shape-keys UIList & the lower slider at once.
This commit is contained in:
2014-12-01 23:30:54 +01:00
parent 44df4242fa
commit 0efa41e996
3 changed files with 26 additions and 0 deletions

View File

@@ -389,6 +389,27 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p)
BLI_assert(0);
}
/**
* Update the pointer for a registered button.
*/
bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src)
{
uiButStore *bs_handle;
bool found = false;
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
uiButStoreElem *bs_elem;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
if (*bs_elem->but_p == but_src) {
*bs_elem->but_p = but_dst;
found = true;
}
}
}
return found;
}
/**
* NULL all pointers, don't free since the owner needs to be able to inspect.
*/