Since user menu entries from SPACE_BUTS/SPACE_TOPBAR are also shown in
other Editors (SPACE_VIEW3D), also allow these entries to be removed
from Quick Favorites from these Editors.
This matches logic from screen_user_menu_draw() in
ui_popup_context_menu_for_button().
Details
- Reviewers
Campbell Barton (campbellbarton) Brecht Van Lommel (brecht) - Maniphest Tasks
- T58327: Quick Favorites "Remove from Favorites" missing for added Modifiers
- Commits
- rB57f0b175d7c9: Fix T61487: quick favorites crash outside of open preferences window
rBSc79b84909765: Fix T58327: Quick Favorites "Remove from Favorites" missing for added Modifiers
rBc79b84909765: Fix T58327: Quick Favorites "Remove from Favorites" missing for added Modifiers
Diff Detail
- Repository
- rB Blender
- Branch
- T58327 (branched from blender2.8)
- Build Status
Buildable 2670 Build 2670: arc lint + arc unit
Event Timeline
After this ED_screen_user_menu_find() is no longer used, and maybe it shouldn't exist at all because it should always check in multiple menus?
Turning it into a ED_screen_user_menus_find() that returns an array might be good, to deduplicate the code.
regarding array handling:
not sure if sommething like this is preferred?
bUserMenu **um_array = NULL; BLI_array_declare(um_array); BLI_array_append(um_array, BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context)); BLI_array_append(um_array, (sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL); BLI_array_append(um_array, (sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_BUTS, context) : NULL); um_array = MEM_reallocN(um_array, sizeof(*um_array) * BLI_array_len(um_array)); *r_len = BLI_array_len(um_array);
sl->spacetype can and does crash. CTX_wm_space_data(C) can return NULL, and when it does, things break.
It can be triggered from area frames (to get menu "Area Options: Split Area, Join Area"), click them like mad with right button, and it will crash at some point. Or maybe only when the menu "Add to Quick Favourites | Assign Shourtcut | Online Manual" opens.
#0 0x00005555575feddc in ED_screen_user_menus_find (C=0x7fffca123808, r_len=0x7fffffffd4cc) at source/blender/editors/screen/screen_user_menu.c:72
sl = 0x0 context = 0x55555bbd660b "objectmode" array_len = 3 um_array = 0x7fffab5343c8 __func__ = "ED_screen_user_menus_find"
So code must handle NULL for sl, or the function below must never return such value.
@gsr b3d (gsrb3d) : thx for letting me know, I'll check this again (am away for christmas though...)
@gsr b3d (gsrb3d) : please excuse the delay on this [just slipped under the radar...]
But was reported again T61487 and fixed rB57f0b175d7c9