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

Destructor and slot for QCoreApplication::aboutToQuit() not called on Windows logout

    XMLWordPrintable

Details

    • Windows

    Description

      Environment

      Processor    11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz   2.80 GHz
      Installed RAM    32.0 GB (31.7 GB usable)
      System type    64-bit operating system, x64-based processor

      Edition    Windows 11 Pro
      Version    21H2
      Installed on    ‎2022-‎05-‎27
      OS build    22000.2057
      Experience    Windows Feature Experience Pack 1000.22001.1000.0

       

      The destructor and slot for QCoreApplication::aboutToQuit() are not called on Windows exit.

      1. The destructor code for MainWindow (derived from QMainWindow) is not called if the user clicked logs out of Windows (or shuts down or restarts it) BEFORE it closes the Qt application. Reproducible for Qt6.3.2 and Qt6.5.1.

      2. The slot code that is connected to the QCoreApplication::aboutToQuit() signal is not called when the user logs out of Windows (or when the system is shut down or rebooted) if the QQuickWebEngineProfile::defaultProfile() function is called somewhere in the program. Reproducible on Qt6.3.2. Not reproducible on Qt6.5.1.

      I am attaching a simple project to reproduce the problems. The code tries to create one file in the destructor and one in the slot for QCoreApplication::aboutToQuit(). And by the fact that the files were not created, we can conclude that the corresponding code was not called.

      3. Perhaps the problem of not calling a slot for QCoreApplication::aboutToQuit() has common causes with the following problem. The Windows SDK includes the rmlogotest.exe utility, which allows you to check whether the application exits gracefully when you log out. Located here C:\Program Files (x86)\Windows Kits\10\App Certification Kit. This utility fails on this attached test project when built with Qt6.3.2:

      "c:\Program Files (x86)\Windows Kits\10\App Certification Kit\rmlogotest.exe" 10544
      LOGO Validation FAILED. Unable to shutdown registered process id 10544 with error code 0000015f
      Debugging Information –
      
      of Proc/Svcs : 1
      Reboot ReasonCode: 00000000
      
           Session 1, Pid 10544, Type 1, Status 1 - RebootHandlingTest.exe() 

      And here is an example of a positive result when checking the attached project when building with Qt6.5.1:

      "c:\Program Files (x86)\Windows Kits\10\App Certification Kit\rmlogotest.exe" 20436
      LOGO Validation PASSED. Successfully stopped process id 20436 

      The rmlogotest.exe utility takes as a parameter the PID of the process to be tested.

      Attachments

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

        Activity

          People

            owolff Oliver Wolff
            rumgot rumgot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes