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

QMetaObject::Connection copies do not update state

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P4: Low P4: Low
    • 5.5.1
    • 5.5.1
    • Core: Object Model
    • None
    • b2be272d354defaebd82dfaa2dffefa5a8f3a303

      The last assert is triggered here:

      #include <QObject>
      int main(int argc, char** argv)
      {
        QObject object;
        int emitted = 0;
        QMetaObject::Connection qConnection = QObject::connect(&object, &QObject::objectNameChanged, [&emitted]
        {
          ++emitted;
        });
        QMetaObject::Connection qConnectionCopy = qConnection;
        QObject::disconnect(qConnection);
        Q_ASSERT(!qConnection);
        Q_ASSERT(!qConnectionCopy);
      }
      

      Either QMetaObject::Connection should not be copyable, or there could be sharing of state like QPersistentModelIndex does.

        For Gerrit Dashboard: QTBUG-46213
        # Subject Branch Project Status CR V

            thiago Thiago Macieira
            ske Steve
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes