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

UB in QDnsLookupThreadPool::start(QRunnable*)

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Network: DNS
    • None

    Description

      The QDnsLookupThreadPool::start function calls QObject::moveToThread(). Since, presumably, the start() function can be called from a non-GUI thread, and not the same one that managed to construct the object in Q_GLOBAL_STATIC (double-checked locking doesn't guarantee anything here; moving this initialization code from start() to the QDLTP ctor would guarantee), this is violating the moveToThread() precondition that the currentThread() is the same as the current QObject::thread() (from https://doc.qt.io/qt-6/qobject.html#moveToThread)

      Warning: This function is not thread-safe; the current thread must be same as the current thread affinity. In other words, this function can only "push" an object from the current thread to another thread, it cannot "pull" an object from any arbitrary thread to the current thread.

      QTBUG-113836 fixed this for 6.6+, but Qt ≤ 6.5 is still affected.

      Attachments

        Issue Links

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

          Activity

            People

              manordheim Mårten Nordheim
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes