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

Port away from nested event loops

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.0 FF
    • dev
    • GRPC
    • All
    • 703f2e3ce (dev)
    • Foundation PM Staging

    Description

      We use nested QEventLoops at some places in QtGrpc, e.g. the function:

      QGrpcStatus QGrpcCallReply::waitForFinished() const
      {
          QEventLoop loop;
          QGrpcStatus status;
          QObject::connect(this, &QGrpcCallReply::errorOccurred, this,
                           [&status, &loop](const QGrpcStatus &error) {
                               status = error;
                               loop.quit();
                           });
          QObject::connect(this, &QGrpcCallReply::finished, &loop, &QEventLoop::quit);    loop.exec();
          return status;
      } 

      uses it. However, nesting event loops can cause conflicts with the main application event loop and can introduce all sorts of surprising behaviors as e.g. "stealing" the parent event loop.

       

      Attachments

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

        Activity

          People

            semlanik Alexey Edelev
            dennisoberst Dennis Oberst
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes