Is it safe to emit signal passing QObject pointer as parameter right before the passed object is going to be destroyed?
问题 Lets consider this simple example: Class Emitter: public QObject { ... signal: surfaceDestroyed(QObject*); public: void emittingMethod(QObject* surface) { emit surfaceDestroyed(surface); delete surface; } } I have a queued connection for this case connect(emitterObject, SIGNAL(surfaceDestroyed(QObject*), receiverObject, SLOT(onSurfaceDestroyed(QObject*)), Qt::QueuedConnection); In onSurfaceDestroyed method the received QObject is dereferenced and used So the question is how safe this code is?