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

UB in QDnsLookupThreadPool::start(QRunnable*)

XMLWordPrintable

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

      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.

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

            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

              Created:
              Updated:

                There are no open Gerrit changes