Skip to content

Fix potential crash when all menu bar show modes are disabled#900

Open
a67793581 wants to merge 1 commit into
jordanbaird:mainfrom
a67793581:fix/crash-when-all-modes-disabled
Open

Fix potential crash when all menu bar show modes are disabled#900
a67793581 wants to merge 1 commit into
jordanbaird:mainfrom
a67793581:fix/crash-when-all-modes-disabled

Conversation

@a67793581

Copy link
Copy Markdown

Description

This PR addresses a potential crash when all menu bar interaction modes ("Show on click", "Show on hover", and "Show on scroll") are disabled.

Changes

  • Added a combined observer in EventManager.swift to monitor the states of all interaction modes, including the "Show context menu on right click" setting.
  • Implemented automatic starting and stopping of all event monitors based on these settings.
  • When all interaction features are disabled, the app will now stop its global event monitors, saving system resources and avoiding unnecessary code path executions that could lead to crashes in certain system states.
  • The monitors are immediately restarted if any of the features are re-enabled by the user.

Verification

The logic ensures that UniversalEventMonitor is only active when there's an actual feature that needs to listen for system-wide mouse or scroll events.

davidrudduck added a commit to davidrudduck/Ice that referenced this pull request Apr 23, 2026
…danbaird#900)

Adapted from upstream PR jordanbaird#900 by a67793581.
Applied to HIDEventManager.swift (renamed from EventManager.swift in macos-26).
davidrudduck added a commit to davidrudduck/Ice that referenced this pull request Apr 23, 2026
Resolved during build verification:

HIDEventManager.swift (PR jordanbaird#893, jordanbaird#900):
- Use NSApplication.shared.sendAction to open settings (AppState has no appDelegate)
- Add .map + .removeDuplicates() to CombineLatest4 to prevent startAll/stopAll
  stack imbalance on repeated setting changes (reviewer finding: HIGH)
- Call handlePreventShowOnHover before early return in fallback to avoid
  skipping hover suppression on settings-open click (reviewer finding: HIGH)

ControlItem.swift (PR jordanbaird#893):
- Move enableSecondaryContextMenu read inside Task body to avoid stale capture
  (reviewer finding: MEDIUM)
- Read setting directly for synchronous rightMouseUp guard

MenuBarOverlayPanel.swift (PR jordanbaird#803):
- Replace removed WindowInfo.getOnScreenWindows() with createWindows(option:)
- Fix validate() guard: returns Bool, not Optional (was always true)

MenuBarItemImageCache.swift (PR jordanbaird#804):
- Replace removed itemCache.allItems with itemCache.managedItems
- Replace .info key with .tag key to match [MenuBarItemTag: CapturedImage] dict
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