[Interest] Crash in QAbstractEventDispatcher::filterNativeEvent when trying to show a QMessageBox

Rainer Wiesenfarth rainer_wiesenfarth at trimble.com
Thu Apr 14 15:24:29 CEST 2022


Qt Version: 5.15.1 / OS Version: Windows 11

Hi all,

I spent already a full day searching for a nasty crash
in QAbstractEventDispatcher::filterNativeEvent() when I try to open a
QMessageBox.

Has anyone an idea what could have caused this behavior?

I don't use explicit event filters, so I have no idea where the invalid
filter should come from. However, I am using QThread, and the crash happens
in a slot connected (queued connection) to a signal emitted by the thread
(m_pWorkerThread). The slot looks like this:

void MyMainWindow::threadDone()
{
  QApplication::restoreOverrideCursor();

  m_pWorkerThread->quit();
  m_pWorkerThread->wait();
  m_pWorkerThread->deleteLater();
  m_pWorkerThread = nullptr;

  QMessageBox::information( this, "MyApplication", "Processing finished." );
}

Call Stack:

> Qt5Core_TP.dll!QAbstractEventDispatcher::filterNativeEvent(const
QByteArray & eventType, void * message, long * result) Line 495 C++
  [Inline Frame] qwindows.dll!QWindowsContext::filterNativeEvent(tagMSG *)
Line 1728 C++
  qwindows.dll!QWindowsContext::windowsProc(HWND__ * hwnd, unsigned int
message, QtWindows::WindowsEventType et, unsigned __int64 wParam, __int64
lParam, __int64 * result, QWindowsWindow * * platformWindowPtr) Line 1157
C++
  qwindows.dll!qWindowsWndProc(HWND__ * hwnd, unsigned int message,
unsigned __int64 wParam, __int64 lParam) Line 1684 C++
  user32.dll!UserCallWinProcCheckWow() Unknown
  user32.dll!DispatchClientMessage() Unknown
  user32.dll!__fnINLPCREATESTRUCT() Unknown
  ntdll.dll!KiUserCallbackDispatcherContinue () Unknown
  win32u.dll!NtUserCreateWindowEx () Unknown
  user32.dll!VerNtUserCreateWindowEx() Unknown
  user32.dll!CreateWindowInternal() Unknown
  user32.dll!CreateWindowExW () Unknown
  qwindows.dll!WindowCreationData::create(const QWindow * w, const
QWindowsWindowData & data, QString title) Line 809 C++
  qwindows.dll!QWindowsWindowData::create(const QWindow * w, const
QWindowsWindowData & parameters, const QString & title) Line 1553 C++
  qwindows.dll!QWindowsIntegration::createPlatformWindow(QWindow * window)
Line 348 C++
  Qt5Gui_TP.dll!QWindowPrivate::create(bool recursive, unsigned __int64
nativeHandle) Line 527 C++
  Qt5Widgets_TP.dll!QWidgetPrivate::create() Line 1316 C++
  Qt5Widgets_TP.dll!QWidget::create(unsigned __int64 window, bool
initializeWindow, bool destroyOldWindow) Line 1182 C++
  Qt5Widgets_TP.dll!QWidgetPrivate::setVisible(bool visible) Line 8062 C++
  Qt5Widgets_TP.dll!QWidget::setVisible(bool visible) Line 8044 C++
  Qt5Widgets_TP.dll!QDialog::setVisible(bool visible) Line 791 C++
  Qt5Widgets_TP.dll!QDialog::exec() Line 595 C++
  Qt5Widgets_TP.dll!showNewMessageBox(QWidget * parent, QMessageBox::Icon
icon, const QString & title, const QString & text, QFlags<enum
QMessageBox::StandardButton> buttons, QMessageBox::StandardButton
defaultButton) Line 1647 C++
  Qt5Widgets_TP.dll!QMessageBox::information(QWidget * parent, const
QString & title, const QString & text, QFlags<enum
QMessageBox::StandardButton> buttons, QMessageBox::StandardButton
defaultButton) Line 1683 C++

Debugger data at the location of the crash (look at "filter"):

- d 0x0000020000030600 {threadId=0x00004d60 interrupt={...}
internalHwnd=0x00000000003c087e {unused=??? } ...}
QAbstractEventDispatcherPrivate * const {QEventDispatcherWin32Private}
  - [QEventDispatcherWin32Private] {threadId=0x00004d60 interrupt={...}
internalHwnd=0x00000000003c087e {unused=??? } ...}
QEventDispatcherWin32Private
    + QAbstractEventDispatcherPrivate {eventFilters={ size = 0x00000001 } }
QAbstractEventDispatcherPrivate
      threadId 0x00004d60 unsigned long
    + interrupt {...} QAtomicInt
    + internalHwnd 0x00000000003c087e {unused=??? } HWND__ *
    + getMessageHook 0x000000000aba0ab9 {unused=0x00000000 } HHOOK__ *
      sendPostedEventsTimerId 0x0000000000000000 unsigned __int64
    + wakeUps {...} QAtomicInt
    + timerVec { size = 0x00000003 } QList<WinTimerInfo *>
    + timerDict { size = 0x00000003 } QHash<int,WinTimerInfo *>
    + sn_read { size = 0x00000000 } QHash<int,QSockNot *>
    + sn_write { size = 0x00000000 } QHash<int,QSockNot *>
    + sn_except { size = 0x00000000 } QHash<int,QSockNot *>
    + active_fd { size = 0x00000000 } QHash<int,QSockFd>
      activateNotifiersPosted false bool
      closingDown false bool
      winEventNotifierListModified false bool
      winEventNotifierActivatedEvent 0x0000000000000000 void *
    + winEventNotifierList { size = 0x00000000 } QList<QWinEventNotifier *>
    + queuedUserInputEvents { size = 0x00000000 } QList<tagMSG>
    + queuedSocketEvents { size = 0x00000000 } QList<tagMSG>
  + QObjectPrivate {extraData=0x0000020000063780 {userData={ size =
0x00000000 } propertyNames={ size = 0x00000000 } propertyValues=...} ...}
QObjectPrivate
  + eventFilters { size = 0x00000001 } QList<QAbstractNativeEventFilter *>
+ eventType windows_generic_MSG const QByteArray &
+ *filter *0x00000200048cefc0 {d=*0xdfdfdfdfdfdfdfdf* {...} }
QAbstractNativeEventFilter *
  i 0x00000000 int
  message 0x000000000014a720 void *
- result 0x000000000014a6f8 {0x00000000} long *
    0x00000000 long
- scopeLevelCounter {threadData=0x00000200000e0600 {_ref={...}
loopLevel=0x00000001 scopeLevel=0x00000002 ...} } QScopedScopeLevelCounter
  - threadData 0x00000200000e0600 {_ref={...} loopLevel=0x00000001
scopeLevel=0x00000002 ...} QThreadData *
    + _ref {...} QAtomicInt
      loopLevel 0x00000001 int
      scopeLevel 0x00000002 int
    + eventLoops { size = 0x00000001 } QStack<QEventLoop *>
    + postEventList { size = 0x00000050 } QPostEventList
    + thread {...} QAtomicPointer<QThread>
    + threadId {...} QAtomicPointer<void>
    + eventDispatcher {...} QAtomicPointer<QAbstractEventDispatcher>
    + tls { size = 0x00000008 } QVector<void *>
    + flaggedSignatures {idx=0x000002d0 locations=0x00000200000e0660
{0x0000000140855740 "1postprocess()", 0x0000000140855790
"2calculationDone()"} } QThreadData::FlaggedDebugSignatures
      quitNow false bool
      canWait false bool
      isAdopted true bool
      requiresCoreApplication true bool

-- 

Rainer Wiesenfarth
Senior Software Engineer
Geospatial Division


Rotebühlstr. 81, 70178 Stuttgart
Germany

Rainer_Wiesenfarth at trimble.com
geospatial.trimble.com/products-and-solutions/trimble-inpho

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim, Eingetragen beim
Amtsgericht Darmstadt unter HRB 83893, Geschäftsführer: Rob Reeder, Jürgen
Kesper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220414/63e27621/attachment.htm>


More information about the Interest mailing list