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

QMetaObject::Connection copies do not update state

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes