Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.0 Alpha
-
None
-
0e72a846d379ba02ff80ecac2526640a05b872b6 (qt/qtbase/dev)
Description
This snippet shows a different behaviour of PMF connects vs. "old style": PMF incorrectly invoke the slot with this == QObject* (and not Object*), which means that f.i. accessing any member variable from that slot would result a in a crash.
With "old style" the slot is not invoked.
#include <QtCore> class Object : public QObject { Q_OBJECT public: Object() { connect(this, &QObject::destroyed, this, &Object::onDestroyed); // connect(this, SIGNAL(destroyed()), this, SLOT(onDestroyed())); } private slots: void onDestroyed() { qDebug() << Q_FUNC_INFO; } }; int main(int argc, char **argv) { QCoreApplication app(argc, argv); Object o; } #include "main.moc"
Attachments
Issue Links
- relates to
-
QTBUG-105746 Fix design flaw which might cause slots to be invoked on partially destroyed objects
-
- Reported
-
- resulted in
-
QTBUG-99232 REG->6.3: Linguist occasionally asserts
-
- Closed
-
For Gerrit Dashboard: QTBUG-33908 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
501586,4 | QObject: assert the object type also for non-PMF connections | dev | qt/qtbase | Status: NEW | -1 | 0 |