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

When using QEvenLoop and Network stack, _q_startOperation seems to be called multiple times

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.2
    • 5.12.0
    • Core: Event loop, Network
    • None
    • - Qt 5.12.0
      - Windows 10 1809 ; Visual Studio Community 2017 (15.9.2)
      - Linux Debian Testing/Unstable ; kernel 4.18.0-2-amd64 ; libc6 2.27-6 ; gcc 8 (8.2.0-8)
    • All
    • 78b422c3415d99713cac98137a9ebad6571eb937

    Description

      Hi.

      When upgrading to 5.12.0 from 5.11.3, a new debug message from Qt appears:

      QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once QUrl
      

      To reproduce the behaviour:

      • create a default "Application Qt with widgets"
      • add in the .pro file
            QT       += network
        
      • copy/paste the following code as mainwindow.cpp
        #include "mainwindow.h"
        #include "ui_mainwindow.h"
        
        #include <QNetworkReply>
        #include <QNetworkAccessManager>
        auto networkAccessManager = new QNetworkAccessManager;
        QEventLoop* loop;
        MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
        {
          ui->setupUi(this);
          loop = new QEventLoop;
          connect(networkAccessManager, &QNetworkAccessManager::finished, [&](QNetworkReply* reply)
          {
            //qDebug("%s", qUtf8Printable(reply->readAll()));
            //reply->deleteLater();
            //loop->quit();
            //loop->deleteLater();
            //loop = nullptr;
          });
          networkAccessManager->get(QNetworkRequest(QUrl("http://google.fr")));
          loop->exec();
        }
        
        MainWindow::~MainWindow()
        {
          delete ui;
        }
        

      The behaviour is consistant across platforms, and doesn't depend on my code as it is triggered between the exec call and the signal emission.

      Attachments

        1. QTBUG-72463.tar.gz
          0.6 kB
          Timur Pocheptsov
        For Gerrit Dashboard: QTBUG-72463
        # Subject Branch Project Status CR V

        Activity

          People

            tpochep Timur Pocheptsov
            lem__mel Majid EL IDRISSI
            Votes:
            5 Vote for this issue
            Watchers:
            17 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes