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

QProcess destructor crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.11.3
    • 5.10.0, 5.10.1, 5.11.0, 5.11.1, 5.11.2
    • Core: Other
    • None
    • Windows
    • 948f8ce2ecb2d6d2713279311d6090268321f0fb

    Description

      The QProcess destructor crashes when it's executed after destroying Q(Core)Application. This is a case when the mentioned QProcess resides in a singleton object, which is destroyed after exiting from main().

      Reproduction steps:

      1. Create a Q(Core)Application in main()
      2. Create the singleton object which creates a QProcess and calls e.g. start("notepad.exe")
      3. Do an early return before app.exec() in the main()

      ER: the application exits properly, and a warning comes about QProcess is being destroyed while it's still running the external process

      AR: the application crashes with read access violation

      One theory is that QProcess cannot handle if it outlives Q(Core)Application.

      Please find the test application in the attachment. I've ran in on Windows 10 1803. The issue comes on MSVC 2015 32-bit and on MSVC 2017 64-bit as well.

      Works fine on 5.9.6. Seems to be broken since 5.10. 5.11.2 affected as well.

       

      Call stack:

      1  QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData>>::data          qscopedpointer.h         140  0x66f6163a
      2  qGetPtrHelper<QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData>>> qglobal.h                1038 0x66fb205b
      3  QEventDispatcherWin32::d_func                                                 qeventdispatcher_win_p.h 72   0x66fb57f3
      4  QEventDispatcherWin32Private::get                                             qeventdispatcher_win_p.h 164  0x66fb66ab
      5  wfsoCallback                                                                  qwineventnotifier.cpp    259  0x672b4116
      6  RtlpTpWaitCallback                                                            ntdll                         0x771459e3
      7  TppExecuteWaitCallback                                                        ntdll                         0x77171314
      8  TppWaitCompletion                                                             ntdll                         0x771718ea
      9  TppWorkerThread                                                               ntdll                         0x7716cf93
      10 BaseThreadInitThunk                                                           KERNEL32                      0x76888484
      11 __RtlUserThreadStart                                                          ntdll                         0x77182fea
      12 _RtlUserThreadStart                                                           ntdll                         0x77182fba
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            tomikaa87qt Tamas Karpati
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes