Qt 6.7 c++20 application is crashing in the event loop
-
wrote on 30 Aug 2024, 13:58 last edited by
My C++ Qt 6.7 program is crashing in the event loop (Qt 6.7.0 for macOs) on this part of the ObjectiveC code :
// Any mouse-press in the frame of the window, including the title bar buttons, should // close open popups. Presses within the window's content are handled to do that in the // NSView::mouseDown implementation. if (theEvent.type == NSEventTypeLeftMouseDown && mouseEventInFrameStrut) QGuiApplicationPrivate::instance()->closeAllPopups(); [super sendEvent:theEvent]; // <-- crashes here, line 345 of qnswindow.mm if (!m_platformWindow) return; // Platform window went away while processing event
Here's the trace:
1 None No value 2 PNGReadPlugin::InitializePluginData(IIOImageReadSession *, IIODictionary *, IIODictionary *, CGImageMetadata *, CGColorSpace * *, ReadPluginData&, PNGPluginData&, __CFDictionary *) (arm64e) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x19656e7e8 3 IIOReadPlugin::callInitialize() (arm64e) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x1965662fc 4 IIO_Reader::initImageAtOffset(CGImagePlugin *, unsigned long, unsigned long, unsigned long) (arm64e) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x196566010 5 IIOImageSource::makeImagePlus(unsigned long, IIODictionary *) (arm64e) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x19656388c 6 IIOImageSource::createImageAtIndex(unsigned long, IIODictionary *) (arm64e) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x19656fe28 7 CGImageSourceCreateImageAtIndex (arm64e) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x19656fcf8 8 setCursorFromBundle (arm64e) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices 0x1922a47a8 9 CoreCursorSetAndReturnSeed (arm64e) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices 0x1922a3aa0 10 -[NSCursor _reallySet] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18fef61b8 11 +[NSCursor _setOverrideCursor:type:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18fefce7c 12 -[NSWindow(NSWindowResizing) _edgeResizingCursorUpdate:atLocation:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18fefc734 13 -[NSThemeFrame mouseEntered:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18ff40890 14 -[NSTrackingArea _dispatchMouseEntered:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18ff407e4 15 -[_NSTrackingAreaAKManager _updateActiveTrackingAreasForWindowLocation:modifierFlags:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x190353a18 16 -[_NSTrackingAreaAKManager routeEnterExitEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x190353cbc 17 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18fecf140 18 -[NSWindow(NSEventRouting) sendEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18feceeb0 19 -[QNSWindow sendEvent:] qnswindow.mm 345 0x103aa7cac 20 +[_NSTrackingAreaAKManager routeEnterExitEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x19034f390 21 +[_NSTrackingAreaManager routeEnterExitEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x19032eab8 22 -[NSApplication(NSEvent) sendEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18fecda10 23 -[QNSApplication sendEvent:] qcocoaapplication.mm 140 0x103a49fdc 24 -[NSApplication _handleEvent:] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x190120098 25 -[NSApplication run] (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x18fd94e30 26 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) qcocoaeventdispatcher.mm 406 0x103a562a0 27 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) qeventloop.cpp 100 0x103ed258c 28 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) qeventloop.cpp 182 0x103ed2568 29 QCoreApplication::exec() qcoreapplication.cpp 1478 0x103ec9084 30 main main.cpp 38 0x1000973a8 31 start
It crashes inconsistently, sometimes it's after a few seconds after starting, and other times it's instantly or a few minutes later. I'm sure I messed up somewhere, but I don't know how to find out where. Any help is much appreciated.
-
Please try compiling your program with C++17. If it still crashes, boil the crash down to a minimal reproducible example and post it here.
-
Please try compiling your program with C++17. If it still crashes, boil the crash down to a minimal reproducible example and post it here.
wrote on 4 Sept 2024, 14:24 last edited by@Axel-Spoerl Hello I am still trying to get a minimal example by slowly removing things from my project (switched to C++17 and still crashing); but I figured out that if I reduce the MainWindow to it's minimum size with my mouse it crashes 100% of the time. Not sure if that random tidbit helps, but I'll keep trying to get a minimal reproducible example.
Thanks for the help.
1/3