Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-29435

WM_QT_SENDPOSTEDEVENTS infinite loop

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.8.4
    • Core: Event loop
    • None
    • Windows 7 x64, Windows XP x86, Windows Server 2003 x64, release & debug Visual Studio 2010 SP1

    Description

      Similar issue: https://bugreports.qt-project.org/browse/QTBUG-28513

      I'm seeing a weird issue in Qt 4.8.4 Visual Studio 2010 SP1. The symptoms - QEventDispatcher goes into an infinite loop while processing WM_QT_SENDPOSTEDEVENTS. This was first not reproducible on all computers I'm testing on, but using remote debugging, I tracked something weird in qeventdispatcher_win.cpp on some of them and managed to actually catch this on all machines later that day.

      entry: bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
      726:         while (!d->interrupt) {
      742:             haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      783:             if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
      784:                 if (seenWM_QT_SENDPOSTEDEVENTS) {
      790:                 seenWM_QT_SENDPOSTEDEVENTS = true;
      807:         if (!filterEvent(&msg)) {
      808:             TranslateMessage(&msg);
      726:         while (!d->interrupt) {
      742:             haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      783:             if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
      784:                 if (seenWM_QT_SENDPOSTEDEVENTS) {
      787:                     needWM_QT_SENDPOSTEDEVENTS = true;
      788:                     continue;
      726:         while (!d->interrupt) {
      742:             haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      838: } while (canWait);
      845: if (needWM_QT_SENDPOSTEDEVENTS)
      846:     PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
      848: exit: return retVal;
      708: entry: bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
      726:         while (!d->interrupt) {
      742:             haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      783:             if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
      784:                 if (seenWM_QT_SENDPOSTEDEVENTS) {
      790:                 seenWM_QT_SENDPOSTEDEVENTS = true;
      807:         if (!filterEvent(&msg)) {
      808:             TranslateMessage(&msg);
      726:         while (!d->interrupt) {
      742:             haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      783:             if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
      784:                 if (seenWM_QT_SENDPOSTEDEVENTS) {
      787:                     needWM_QT_SENDPOSTEDEVENTS = true;
      788:                     continue;
      726:         while (!d->interrupt) {
      742:             haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      838: } while (canWait);
      845: if (needWM_QT_SENDPOSTEDEVENTS)
      846:     PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
      848: exit: return retVal;
      

      The message gets re-posted. The place that controls this checks if it's just been posted on line 783, just to be re-posted on line 846. I don't know the meaning of d->internalHwnd == msg.hwnd on line 783, though. It's clear that an infinite loop will arise, if you're posting it with d->internalHwnd on line 846.

      This may affect both x64, x86 and x86 debug Qt libraries and seems to be related to ZeroTimerEvent. The event results in QApplication::notify, with receiver having its virtual function table pointing to QtWebKitd4.dll!WebCore::SharedTimerQt::metaObject(void)const. But, the window containing the web view has been long supposed to be closed (The close() method has already been called on it). In other words, closing the window containing a QWebView causes some timer go haywire under specific conditions.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              mdealer Edgars Batnya
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes