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

Not destroying QNetworkAccessManager object may result in process crash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P4: Low P4: Low
    • None
    • 5.10.1
    • Network
    • None
    • macOS 10.13.4

      Qt 5.10.1 (installed via Homebrew)

      Compiler Apple LLVM version 9.1.0 (clang-902.0.39.1)

       

      It appears that failing to destroy a QNetworkAccessManager may result in a process crash.

      How to reproduce

      1. Compile this C++ program

      #include <QCoreApplication>
      #include <QNetworkAccessManager>
      
      int main( int argc, char **argv )
      {
          QCoreApplication app( argc, argv );
          (void) new QNetworkAccessManager();
      }
      

      2. Execute the program in an infinite loop, e.g. via

      $ while ./main; do; done
      

      Expected Behaviour

      The loop never terminates, the program always returns with exit code 0.

      Observed Behaviour

      The loop eventually (sometimes sooner, sometimes later) terminates since the program crashes. In some cases, the message 'Pure virtual function called!' is printed, in other cases no such message is printed.

      The issue can be worked around by ensuring that the QNetworkAccessManager is destroyed, e.g. by allocating the instance on the stack or delete'ing a dynamically allocated instance.

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

            tpochep Timur Pocheptsov
            frerich Frerich Raabe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes