Skip to content

nemo-tree-sidebar.c: Fix context menu handling for invalid rows. - #3840

Open
MiQ71 wants to merge 1 commit into
linuxmint:masterfrom
MiQ71:fix-tree-sidebar-empty-context-menu
Open

MiQ71 wants to merge 1 commit into
linuxmint:masterfrom
MiQ71:fix-tree-sidebar-empty-context-menu

Conversation

@MiQ71

@MiQ71 MiQ71 commented Sep 17, 2026

Copy link
Copy Markdown

Fix context menu handling in the tree sidebar when there is no valid file associated with the target row.

This fixes two existing crash cases:

While testing the fix, I also found that invoking the context menu from the keyboard (Shift+F10) could crash when the tree view had focus but no valid row was selected. In this case the popup-menu signal calls popup_menu() without a GdkEventButton, while update_menu_states() unconditionally dereferenced the event.

The change:

  • uses the mouse position for pointer-triggered context menus;
  • uses the current tree cursor for keyboard-triggered context menus;
  • checks that the tree path resolves to a valid NemoFile;
  • only opens the context menu when a valid target was found.

Tested with a local build of Nemo 6.7.6:

  • right-click on a normal tree entry: context menu works;
  • Properties on a normal entry: works;
  • right-click below the tree entries: no menu, no crash;
  • right-click on an (Empty) placeholder: no menu, no crash;
  • Shift+F10 on a valid tree entry: context menu works;
  • Shift+F10 without a valid tree entry: no crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant