Crash after save with mouse on Mac menu bar
<!-- --------Before Creating a New Issue-----------
* Limit report to a single issue.
* Search the issue tracker to verify the issue has not already been reported.
* Complete all instructions between `template comment markers <>.
* Keep report contents limited to the necessary information required to fix the issue.
* When creating an issue against the stable version of KiCad, make sure the latest available stable version is installed as issues may have already been resolved in later stable versions. -->
# Description
KiCad just crashed on me, possibly related to earlier reports of issues with mouse over the Mac menu bar. I can't reproduce the same crash now.
```
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: kicad [58986]
Path: /Users/USER/*/KiCad.app/Contents/MacOS/kicad
Identifier: org.kicad.kicad
Version: 8.0.0-rc2-260-g18692ea8e7 (8.0.0-rc2-260-g18692ea8e7)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2024-01-31 14:32:56.3507 -0800
OS Version: macOS 14.2.1 (23C71)
Report Version: 12
Anonymous UUID: 0B770BD3-37DB-5FD8-F5F2-D277A651BA40
Sleep/Wake UUID: DA2F7B1F-C53B-408B-A100-6D39689EB997
Time Awake Since Boot: 1000000 seconds
Time Since Wake: 18713 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000a7ffff7428
Exception Codes: 0x0000000000000001, 0x000000a7ffff7428
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [58986]
VM Region Info: 0xa7ffff7428 is not in any region. Bytes after previous region: 240518132777 Bytes before following region: 104831561796568
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
commpage (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated)
---> GAP OF 0x5f9000000000 BYTES
MALLOC_NANO 600000000000-600020000000 [512.0M] rw-/rwx SM=PRV
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 _pcbnew.kiface 0x2d6d82b9c ACTION_MENU::OnMenuEvent(wxMenuEvent&) + 120
1 _pcbnew.kiface 0x2d6db5004 TOOL_DISPATCHER::DispatchWxEvent(wxEvent&) + 3628
2 libwx_osx_cocoau-3.2.0.2.2.dylib 0x10786fbb4 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 444
3 libwx_osx_cocoau-3.2.0.2.2.dylib 0x1078710d0 wxEvtHandler::ProcessEvent(wxEvent&) + 260
4 _pcbnew.kiface 0x2d6cf30fc EDA_BASE_FRAME::ProcessEvent(wxEvent&) + 100
5 libwx_osx_cocoau-3.2.0.2.2.dylib 0x10787125c wxEvtHandler::ProcessEventLocally(wxEvent&) + 212
6 libwx_osx_cocoau-3.2.0.2.2.dylib 0x107871004 wxEvtHandler::ProcessEvent(wxEvent&) + 56
7 libwx_osx_cocoau-3.2.0.2.2.dylib 0x107871734 wxEvtHandler::SafelyProcessEvent(wxEvent&) + 24
8 libwx_osx_cocoau-3.2.0.2.2.dylib 0x107a20fa4 wxMenuBase::ProcessMenuEvent(wxMenu*, wxMenuEvent&, wxWindow*) + 24
9 libwx_osx_cocoau-3.2.0.2.2.dylib 0x1078cba9c wxMenu::HandleMenuItemHighlighted(wxMenuItem*) + 108
10 AppKit 0x184bf67c4 -[NSMenu _informDelegateOfHighlightedItem:] + 140
11 AppKit 0x185151264 -[NSCocoaMenuImpl _addHighlightForView:] + 356
12 AppKit 0x185150ea4 __60-[NSCocoaMenuImpl _highlightMenuItemView:shouldOpenSubmenu:]_block_invoke + 224
13 AppKit 0x185150b48 -[NSCocoaMenuImpl _highlightMenuItemView:shouldOpenSubmenu:] + 368
14 AppKit 0x185150094 -[NSCocoaMenuImpl _routeEventIfNeeded:toSubview:] + 564
15 AppKit 0x18514fc14 -[NSCocoaMenuImpl handleMouseEvent:] + 232
16 AppKit 0x185641b30 -[NSMenuBarImpl mouseDown:] + 128
17 AppKit 0x184f756e8 -[NSMenuTrackingSession _mouseDownEventHandler:] + 184
18 AppKit 0x185018f64 -[NSMenuBarTrackingSession _mouseDownEventHandler:] + 160
19 AppKit 0x185018eac -[NSMenuBarTrackingSession handleEvent:] + 316
20 AppKit 0x185018d08 __57-[NSMenuBarTrackingSession _addLocalEventMonitorIfNeeded]_block_invoke + 56
21 AppKit 0x184b4a4ac _NSSendEventToDequeuingObservers + 252
22 AppKit 0x185128f88 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2260
23 AppKit 0x184941d50 -[NSApplication run] + 476
24 libwx_osx_cocoau-3.2.0.2.2.dylib 0x1079460f4 wxGUIEventLoop::OSXDoRun() + 140
25 libwx_osx_cocoau-3.2.0.2.2.dylib 0x107849074 wxCFEventLoop::DoRun() + 40
26 libwx_osx_cocoau-3.2.0.2.2.dylib 0x1077a79e4 wxEventLoopBase::Run() + 200
27 libwx_osx_cocoau-3.2.0.2.2.dylib 0x107777490 wxAppConsoleBase::MainLoop() + 208
28 libwx_osx_cocoau-3.2.0.2.2.dylib 0x1078e5098 wxApp::OnRun() + 36
29 kicad 0x104376fd0 APP_KICAD::OnRun() + 20
30 libwx_osx_cocoau-3.2.0.2.2.dylib 0x1077d8c14 wxEntry(int&, wchar_t**) + 104
31 kicad 0x1043755f0 main + 52
32 dyld 0x180d150e0 start + 2360
```
[kicad_v8rc2_crash_save_over_menu.txt](/uploads/fb1a8f8f348efd50b6e3f68d897dfcdd/kicad_v8rc2_crash_save_over_menu.txt)
<!-- What is the current behavior and what is the expected behavior? -->
<!-- If the issue is visual/graphical, please attach screenshots of the problem. -->
<!-- Add the issue details below this line and before the "Steps to reproduce" heading. -->
# Steps to reproduce
<!-- If there are multiple steps to reproduce it or it is a visual issue, then providing a screen recording as an attachment to this report is recommended. -->
<!-- If this issue is specific to a project, please attach the necessary files to this issue. -->
<!-- Add the steps to reproduce using the numbers below -->
<!-- Add new step numbers before the "KiCad Version" heading. -->
I believe what happened was:
1. Have empty PCB editor open, move mouse up and away from editor to Mac menu bar
2. Click on KiCad menu item, going to open preferences
3. Instinctively attempt to save at the same time, press Cmd+S
4. Crash
# KiCad Version
<!-- Copy version information (from main menu Help->About KiCad ->Copy Version Info) and paste it between the triple backticks below to preserve the formatting. -->
```
Application: KiCad PCB Editor arm64 on arm64
Version: 8.0.0-rc2-260-g18692ea8e7, release build
Libraries:
wxWidgets 3.2.4
FreeType 2.13.2
HarfBuzz 8.2.0
FontConfig 2.14.2
libcurl/8.4.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.55.1
Platform: macOS Sonoma Version 14.2.1 (Build 23C71), 64 bit, Little endian, wxMac
Build Info:
Date: Jan 30 2024 08:07:11
wxWidgets: 3.2.4 (wchar_t,wx containers)
Boost: 1.82.0
OCC: 7.7.2
Curl: 7.87.0
ngspice: 42
Compiler: Clang 14.0.3 with C++ ABI 1002
Build settings:
```
issue