diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-10-19 11:18:54 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-10-19 17:42:00 +0300 |
commit | 57f1379104e7e36dd60fc270253e4a4555f0e699 (patch) | |
tree | 4df01c6d7cea669fc4c1f290958a675f1b46179f /source/blender/editors/space_outliner/outliner_draw.c | |
parent | b3b7319de7aaa17d96e304857bc57401bb11ad17 (diff) |
Fix T92265: Outliner crash clicking override warning buttons
`outliner_draw_overrides_buts` uses `uiDefIconBlockBut` but doing so
without defining a function callback to actually build a block.
This will make the button go down the route of spawning a popup, but
without a menu. Crash then happens later accesing the (missing) menu in
`ui_handler_region_menu`.
So while we could dive into making this usage failsafe (carefully
checking `BUTTON_STATE_MENU_OPEN` in combination with
`uiHandleButtonData->menu` being NULL all over), but it seems much more
straightforward to just use `uiDefIconBut` (instead of
`uiDefIconBlockBut`) since this Override Warning buttons seem not to
intend spawning a menu anyways?
Maniphest Tasks: T92265
Differential Revision: https://developer.blender.org/D12917
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 7cdfb553da5..956c455c545 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1841,16 +1841,20 @@ static bool outliner_draw_overrides_buts(uiBlock *block, if (tip == NULL) { tip = TIP_("Some sub-items require attention"); } - uiBut *bt = uiDefIconBlockBut(block, - NULL, - NULL, - 1, - ICON_ERROR, - (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_STATUS), - te->ys, - UI_UNIT_X, - UI_UNIT_Y, - tip); + uiBut *bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 1, + ICON_ERROR, + (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_STATUS), + te->ys, + UI_UNIT_X, + UI_UNIT_Y, + NULL, + 0.0, + 0.0, + 0.0, + 0.0, + tip); UI_but_flag_enable(bt, but_flag); } any_item_has_warnings = any_item_has_warnings || item_has_warnings || any_child_has_warnings; |