if (senderLists)
senderLists->dirty = true;
+ int signal_index = node->signal_index;
node = node->next;
if (needToUnlock)
m->unlock();
+ sender->disconnectNotify(QMetaObjectPrivate::signal(sender->metaObject(), signal_index));
}
}
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
c->sender = s;
+ c->signal_index = signal_index;
c->receiver = r;
c->method_relative = method_index;
c->method_offset = method_offset;
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
c->sender = s;
+ c->signal_index = signal_index;
c->receiver = r;
c->slotObj = slotObj;
c->connectionType = type;
QAtomicInt ref_;
ushort method_offset;
ushort method_relative;
+ uint signal_index : 27; // In signal range (see QObjectPrivate::signalIndex())
ushort connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
ushort isSlotObject : 1;
ushort ownArgumentTypes : 1;
QVERIFY(QObject::connect((SenderObject*)s, SIGNAL(signal1()), (ReceiverObject*)r, SLOT(slot1())));
delete r;
- // disconnectNotify() is not called, but it probably should be.
- QVERIFY(s->disconnectedSignals.isEmpty());
+ QCOMPARE(s->disconnectedSignals.count(), 1);
+ QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal1));
+
+ s->disconnectedSignals.clear();
+ r = new NotifyObject;
+
+ QVERIFY(QObject::connect((SenderObject*)s, SIGNAL(signal3()), (ReceiverObject*)r, SLOT(slot3())));
+
+ delete r;
+ QCOMPARE(s->disconnectedSignals.count(), 1);
+ QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal3));
+
+ s->disconnectedSignals.clear();
+ r = new NotifyObject;
+
+ QVERIFY(QObject::connect((SenderObject*)s, SIGNAL(destroyed()), (ReceiverObject*)r, SLOT(slot3())));
+
+ delete r;
+ QCOMPARE(s->disconnectedSignals.count(), 1);
+ QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&QObject::destroyed));
delete s;
}
void dynamic_property_benchmark();
void connect_disconnect_benchmark_data();
void connect_disconnect_benchmark();
+ void receiver_destroyed_benchmark();
};
struct Functor {
}
}
+void QObjectBenchmark::receiver_destroyed_benchmark()
+{
+ Object sender;
+ QBENCHMARK {
+ Object receiver;
+ QObject::connect(&sender, &Object::signal0, &receiver, &Object::slot0);
+ }
+}
+
QTEST_MAIN(QObjectBenchmark)
#include "main.moc"