graphia-app / graphia

A visualisation tool for the creation and analysis of graphs
https://graphia.app
236 stars 21 forks source link

macOS graph size estimate plot crash #38

Open timangus opened 2 years ago

timangus commented 2 years ago

There is a rare crash that occurs when interacting with the graph size estimate plot, but only on macOS. The crash occurs in QOpenGLContext::makeCurrent:

[ 00 ] QOpenGLContext::makeCurrent(QSurface*)
[ 01 ] reallocateBuffer
[ 02 ] setupPaintBuffers
[ 03 ] replot
[ 04 ] QObject::event(QEvent*)
[ 05 ] event
[ 06 ] QApplicationPrivate::notify_helper(QObject*, QEvent*)
[ 07 ] QApplication::notify(QObject*, QEvent*)
[ 08 ] QCoreApplication::notifyInternal2(QObject*, QEvent*)
[ 09 ] QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
[ 10 ] QCocoaEventDispatcherPrivate::processPostedEvents()
[ 11 ] QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*)
[ 12 ] __CFRunLoopDoSource1
[ 13 ] __CFRunLoopDoSource1
[ 14 ] __CFRunLoopServiceMachPort
[ 15 ] __CFRunLoopRun
[ 16 ] CFArrayGetCountOfValue
[ 17 ] RunCurrentEventLoopInMode
[ 18 ] ReceiveNextEventCommon
[ 19 ] _BlockUntilNextEventMatchingListInModeWithFilter
[ 20 ] _DPSNextEvent
[ 21 ] -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
[ 22 ] -[NSApplication _doModalLoop:peek:]
[ 23 ] __33-[NSApplication runModalSession:]_block_invoke_2
[ 24 ] __33-[NSApplication runModalSession:]_block_invoke
[ 25 ] _NSTryRunModal
[ 26 ] -[NSApplication runModalSession:]
[ 27 ] QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
[ 28 ] QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
[ 29 ] QCoreApplication::exec()
[ 30 ] start
[ 31 ] main
[ 32 ] 0x7fff70d36cc9

With some tedious logging and investigation it looks like the crash is actually in QWindow::surfaceHandle() (presumably inlined into ::makeCurrent). 5d534b7 disables OpenGL acceleration on macOS for QCustomPlotQuickItem based plots, hopefully preventing this crash. A warning is also added that is triggered when building against a newer version of Qt; there is some circumstantial evidence it was a bug in Qt that has subsequently been fixed, so hopefully OpenGL can be re-enabled in future.