mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-16 11:39:57 +00:00
buildMenu reassigns every menu item pointer under menuMu, but the status path (refreshMenuItemsForStatus, applyStatusIndicator), the click handlers and the session ticker read them unguarded. Wails dispatches event listeners and OnClick callbacks on fresh goroutines, so these reads race the rebuilds and applyStatus even runs concurrently with itself. - applyStatus drives a single aggregated relayoutMenu (status, daemon version and session-deadline changes); refreshMenuItemsForStatus is removed — relayoutMenu repaints the same items from the caches - applyStatusIndicator is SetBitmap-only: its unguarded SetMenu could reinstall a stale tree and pushed a half-built one on every relayout - Connect/Disconnect handlers receive the clicked item from the buildMenu closure instead of reading the menuMu-guarded fields - applySessionExpiry is cache-only; the row is painted by relayoutMenu, the 30s ticker snapshots its item under menuMu - drop loadProfiles' dead unguarded profileSubmenu nil-check