Page MenuHome

Fix T58327: Quick Favorites "Remove from Favorites" missing for added Modifiers
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Dec 20 2018, 1:01 PM.

Details

Summary

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().

Diff Detail

Repository
rB Blender

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);

It's fine this way.

This revision is now accepted and ready to land.Dec 21 2018, 1:50 PM
This revision was automatically updated to reflect the committed changes.

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) reopened this revision.Dec 22 2018, 4:30 AM
This revision is now accepted and ready to land.Dec 22 2018, 4:30 AM

@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