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

dialog not showing and application hanging (infinite loop) when using a zero second -timer under windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.0.0 RC 1
    • None
    • VS2012 / windows 7
      (this happens since I switched from VS2010 to VS2012)

    Description

      Basically, when an assert is being triggered, the message box dialog doesn’t get displayed. As the dialog isn’t visible, I can’t press “ignore” or “break” button, and therefore the application is stuck.

      I am using Q_ASSERT.

      I found out that this happens only for the message boxes shown after I have started my 3D window repaint timer:

      myTimer.setInterval(0);
      connect(&myTimer, SIGNAL(timeout()), this, SLOT(OnTimer()));
      myTimer.start();
      

      If I don’t start the time, then the problem doesn’t occur…

      Digging further, it seems that __crtMessageBox() internally trigger the following messages handling function to be called:

       
      LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
      

      One of ther message in the queue is “WM_QT_SENDPOSTEDEVENTS”, so “q->sendPostedEvents();” gets called, leading to “bool QEventDispatcherWin32::event(QEvent *e)” being called.

      In this method the “zero-timer” constantly posts an event in this function method:

       
      QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId()));
      

      This makes it enter in a kind of infinite event-processing loop (as “DefWindowProc(hwnd, message, wp, lp);” gets never called)… No idea how I can solve this…

      Below the callstack (Qt5 rc) in my own app:

      I have attached a modified version of Qt5rc1 "qtbase\examples\widgets\tutorials\gettingStarted\gsQt\part4" example. Simply replace the main.cpp file with the one attached, compile a debug version with VS2012, then run the exectuable.
      When the Notepad shows up, select "File" menu, and "Load" menu item. It should display an assert message box but the application hangs instead.

      Attachments

        1. callstack.jpg
          442 kB
          Gregory Jaegy
        2. main.cpp
          3 kB
          Gregory Jaegy
        3. part4.exe
          69 kB
          Gregory Jaegy
        4. qtbug28513.tar
          10 kB
          Friedemann Kleint

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              gjaegy Gregory Jaegy
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes