hluk/CopyQ
View on GitHubSegfault and application crash when clicking outside the tray menu
Open
#3187 opened on Sep 20, 2025
Qt bugbughelp wantedmacOS
Description
Describe the bug
On macOS with Qt6, the application sometimes crashes with a segmentation fault (Signal 11) when interacting with the tray icon or global shortcuts. The crash appears to occur when the main window loses focus (resignKeyWindow) and a shortcut triggers tray/menu operations simultaneously. This prevents reliable tray usage and makes the application unstable.
To Reproduce Steps to reproduce the behavior:
- Build CopyQ with Qt6 on macOS (tested on macOS 26).
- Launch CopyQ and ensure the main window is active.
- Press the global tray shortcut. Now close the tray by clicking outside of this tray menu.
- This will lead to immediate closure of application without any prompt or crash report.
Expected behavior
- The tray icon should respond to the shortcut.
- The application should never crash (Signal 11) regardless of window focus or shortcut timing.
Version, OS and Environment
- OS: macOS 26
- Qt version: Qt6
- Installation method: built from source
Additional context
- Crash stack trace consistently shows:
jazz@Jaswanths-MacBook-Air CopyQ % cat /tmp/copyq_crash_debug.txt === CRASH/TERMINATION AT Sat Sep 20 07:42:25 2025 === Reason: Signal 11 Stack trace: 0: 0 CopyQ 0x000000010453031c _ZN12_GLOBAL__N_115writeStackTraceERK7QString + 328 1: 1 CopyQ 0x00000001045300fc _ZN12_GLOBAL__N_112crashHandlerEi + 92 2: 2 libsystem_platform.dylib 0x0000000188d22744 _sigtramp + 56 3: 3 libqcocoa.dylib 0x0000000107db2a7c _ZN12QCocoaWindow18windowDidResignKeyEv + 996 4: 4 libqcocoa.dylib 0x0000000107db2a7c _ZN12QCocoaWindow18windowDidResignKeyEv + 996 5: 5 QtCore 0x0000000106b48240 _ZN18QMetaMethodInvoker10invokeImplE11QMetaMethodPvN2Qt14ConnectionTypeExPKPKvPKPKcPKPKN9QtPrivate18QMetaTypeInterfaceE + 916 6: 6 QtCore 0x0000000106b4bf74 _ZN11QMetaMethod10invokeImplES_PvN2Qt14ConnectionTypeExPKPKvPKPKcPKPKN9QtPrivate18QMetaTypeInterfaceE + 76 7: 7 libqcocoa.dylib 0x0000000107db6960 ___ZL30qRegisterNotificationCallbacksv_block_invoke + 1220 8: 8 CoreFoundation 0x0000000188dae560 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 128 9: 9 CoreFoundation 0x0000000188e170c4 ___CFXRegistrationPost_block_invoke + 92 10: 10 CoreFoundation 0x0000000188e17008 _CFXRegistrationPost + 436 11: 11 CoreFoundation 0x0000000188d8d08c _CFXNotificationPost + 740 12: 12 Foundation 0x000000018af963e0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 13: 13 AppKit 0x000000018d249fcc -[NSWindow resignKeyWindow] + 620 14: 14 AppKit 0x000000018d2bf244 -[NSPanel resignKeyWindow] + 72 15: 15 AppKit 0x000000018de3c094 -[NSWindow _sendResignKeyWindow] + 100 16: 16 AppKit 0x000000018d249cc8 _NXEndKeyAndMain + 120 17: 17 AppKit 0x000000018d6f5f9c -[NSApplication _handleDeactivateEvent:] + 700 18: 18 AppKit 0x000000018dbf645c -[NSApplication(NSEventRouting) sendEvent:] + 1024 19: 19 libqcocoa.dylib 0x0000000107d7bc68 -[QNSApplication sendEvent:] + 84 20: 20 AppKit 0x000000018d6f0798 -[NSApplication _handleEvent:] + 60 21: 21 AppKit 0x000000018d19d748 -[NSApplication run] + 408 22: 22 libqcocoa.dylib 0x0000000107d88a70 _ZN21QCocoaEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE + 2008 23: 23 QtCore 0x0000000106b465b4 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE + 448 24: 24 QtCore 0x0000000106b3f670 _ZN16QCoreApplication4execEv + 220 25: 25 CopyQ 0x000000010452f774 main + 3460 26: 26 dyld 0x0000000188959d54 start + 7184 === END CRASH INFO ===