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

QTimer/QBasicTimer hangs if there is no visible window on Mac

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.2
    • QPA
    • None
    • Qt 5.9.2

      Mac OS X Sierra(10.12)
    • macOS

    Description

      When you have a timer and a hidden window on Mac using the QtWidgets/QApplication(I guess that QGuiApplication should be also affected) the timers are fired with delay of seconds.

      Here is exactly my case. I have a QApplication based app with setQuitOnLastWindowClosed(false). On startup the application creates a hidden QDialog and starts listening for events based on shared memory. I use QBasicTimer to check the shared memory every 100ms and if needed I bring up the QDialog(non-modal). However after several seconds the timerEvents starts to dispatch with a delay of more than 5 seconds. If the QDialog is visible there is no issues. I did hit the pause button and it seems that the code is stuck somewhere in QCocoaEventDispatcher:: processEvents().

      This bug is not present if I use QCoreApplication but I see that it's event loop is not based on QCocoaEventDispatcher.

      Update: I have attached a sample project that reproduce the bug. Just run it and wait about 30-40 seconds. The timer will begin to fire much slower.

       

      Attachments

        1. qtimermactest.zip
          2 kB
          Nikolay Nikolov Baklicharov
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            storm Nikolay Nikolov Baklicharov
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes