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

Thread safety issue with QQmlPropertyMap & QMetaObject::invokeMethod

XMLWordPrintable

    • 38bac80aea1c2bd58acb10000e9a3daa65bba503 (qt/qtdeclarative/5.12)

      I'm trying to use QMetaObject::invokeMethod with QueuedConnection to safely pass control from one thread to another. If invokeMethod (on a secondary thread) happens simultaneously with QQmlPropertyMap::insert (on main thread), Qt may crash. There seems to be no locking around the code which modifies the QMetaObject.

      If it's not fixable, then it should at least be documented what conditions need to be met in order to safely use invokeMethod with QueuedConnection from a different thread.

      Minimal test-case attached.

        1. metabug.cpp
          0.8 kB
          Andrzej Szombierski
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vhilshei Volker Hilsheimer
            anszom Andrzej Szombierski
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes