Details
-
Bug
-
Resolution: Out of scope
-
P1: Critical
-
None
-
5.12
Description
We have recently discovered an issue that seems to have been introduced in Qt 5.12 (tested with Qt 5.12.3 and 5.12.4).
I have attached a minimal example that demonstrates the issue. What can be observed is, that after multiple quick clicks on the tray icon, the program eventually crashes.
I believe the problem is that the window is closed when focus is lost and hidden when clicking the tray icon and the window is visible. Sometimes those two actions seem to occur simultaneously, which causes the program to crash.
Closing the window instead of hiding it when clicking the tray icon fixes this issue, but as this did not occur in Qt 5.11, but does in 5.12, I feel like this might still be unwanted behaviour. If this is expected to happen, feel free to close this ticket.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: EXC_I386_GPFLT Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [95800] Application Specific Information: objc_msgSend() selector name: window Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff624cb697 objc_msgSend + 23 1 libqcocoa.dylib 0x00000001141ff6dc QCocoaWindow::setVisible(bool) + 1068 2 org.qt-project.QtGui 0x00000001103b12e2 QWindowPrivate::setVisible(bool) + 1154 3 com.yourcompany.qtbug76841 0x000000010fdc0911 TrayIcon::TrayIcon()::'lambda'(QSystemTrayIcon::ActivationReason)::operator()(QSystemTrayIcon::ActivationReason) const + 401 (trayicon.h:31) 4 com.yourcompany.qtbug76841 0x000000010fdc0763 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QSystemTrayIcon::ActivationReason>, void, TrayIcon::TrayIcon()::'lambda'(QSystemTrayIcon::ActivationReason)>::call(TrayIcon::TrayIcon()::'lambda'(QSystemTrayIcon::ActivationReason)&, void**) + 35 (qobjectdefs_impl.h:146) 5 com.yourcompany.qtbug76841 0x000000010fdc0701 void QtPrivate::Functor<TrayIcon::TrayIcon()::'lambda'(QSystemTrayIcon::ActivationReason), 1>::call<QtPrivate::List<QSystemTrayIcon::ActivationReason>, void>(TrayIcon::TrayIcon()::'lambda'(QSystemTrayIcon::ActivationReason)&, void*, void**) + 33 (qobjectdefs_impl.h:257) 6 com.yourcompany.qtbug76841 0x000000010fdc066d QtPrivate::QFunctorSlotObject<TrayIcon::TrayIcon()::'lambda'(QSystemTrayIcon::ActivationReason), 1, QtPrivate::List<QSystemTrayIcon::ActivationReason>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) + 157 (qobjectdefs_impl.h:440) 7 org.qt-project.QtCore 0x0000000111051d0b QMetaObject::activate(QObject*, int, int, void**) + 2219 8 org.qt-project.QtWidgets 0x000000011015d371 QSystemTrayIcon::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 1201 9 org.qt-project.QtCore 0x000000011105209c QMetaObject::activate(QObject*, int, int, void**) + 3132 10 org.qt-project.QtGui 0x00000001103e2d6b QPlatformSystemTrayIcon::activated(QPlatformSystemTrayIcon::ActivationReason) + 59 11 libqcocoa.dylib 0x0000000114237537 -[QNSStatusItem triggerSelector:button:] + 55 12 com.apple.AppKit 0x00007fff35633b37 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 5724 13 com.apple.AppKit 0x00007fff3556a3a6 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2295 14 com.apple.AppKit 0x00007fff35569867 -[NSWindow(NSEventRouting) sendEvent:] + 478 15 com.apple.AppKit 0x00007fff35bc5f2a -[NSStatusBarWindow sendEvent:] + 347 16 com.apple.AppKit 0x00007fff3540904f -[NSApplication(NSEvent) sendEvent:] + 331 17 libqcocoa.dylib 0x000000011421d3ea -[QNSApplication sendEvent:] + 74 18 com.apple.AppKit 0x00007fff353f7874 -[NSApplication run] + 755 19 libqcocoa.dylib 0x0000000114219ccb QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2955 20 org.qt-project.QtCore 0x000000011101c50f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431 21 org.qt-project.QtCore 0x0000000111021452 QCoreApplication::exec() + 130 22 com.yourcompany.qtbug76841 0x000000010fdbfc36 main + 70 (main.cpp:11) 23 libdyld.dylib 0x00007fff63ca73d5 start + 1 Thread 1: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 2: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 3: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 4: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 5: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 6: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 7: 0 libsystem_pthread.dylib 0x00007fff63e9a3f0 start_wqthread + 0 Thread 8:: QQmlThread 0 libsystem_kernel.dylib 0x00007fff63de436e poll + 10 1 org.qt-project.QtCore 0x00000001110770a0 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 608 2 org.qt-project.QtCore 0x0000000111078897 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 903 3 org.qt-project.QtCore 0x000000011101c50f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431 4 org.qt-project.QtCore 0x0000000110e590fc QThread::exec() + 140 5 org.qt-project.QtQml 0x0000000110b3d149 QQmlThreadPrivate::run() + 57 6 org.qt-project.QtCore 0x0000000110e5a073 QThreadPrivate::start(void*) + 323 7 libsystem_pthread.dylib 0x00007fff63e9b2eb _pthread_body + 126 8 libsystem_pthread.dylib 0x00007fff63e9e249 _pthread_start + 66 9 libsystem_pthread.dylib 0x00007fff63e9a40d thread_start + 13 Thread 9:: com.apple.NSEventThread 0 libsystem_kernel.dylib 0x00007fff63ddc22a mach_msg_trap + 10 1 libsystem_kernel.dylib 0x00007fff63ddc76c mach_msg + 60 2 com.apple.CoreFoundation 0x00007fff37d79bee __CFRunLoopServiceMachPort + 328 3 com.apple.CoreFoundation 0x00007fff37d7915c __CFRunLoopRun + 1612 4 com.apple.CoreFoundation 0x00007fff37d788be CFRunLoopRunSpecific + 455 5 com.apple.AppKit 0x00007fff354066a6 _NSEventThread + 175 6 libsystem_pthread.dylib 0x00007fff63e9b2eb _pthread_body + 126 7 libsystem_pthread.dylib 0x00007fff63e9e249 _pthread_start + 66 8 libsystem_pthread.dylib 0x00007fff63e9a40d thread_start + 13 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x00007ffab6c08130 rbx: 0x00007ffedfe42a00 rcx: 0x0000000000000210 rdx: 0x0000000000000003 rdi: 0x6f636552746e6576 rsi: 0x00007fff35f849e3 rbp: 0x00007ffedfe42a90 rsp: 0x00007ffedfe429e8 r8: 0x00007ffabc800000 r9: 0x2248922448944844 r10: 0x00007ffffffffff8 r11: 0x0000000111422a00 r12: 0x00007ffab6c07410 r13: 0x0000000000000000 r14: 0x00007ffab6c07420 r15: 0x0000000000000000 rip: 0x00007fff624cb697 rfl: 0x0000000000010246 cr2: 0x0000000111605000 Logical CPU: 0 Error Code: 0x00000000 Trap Number: 13