C++ (Qt)bool QCoreApplication::notifyInternal2(QObject *receiver, QEvent *event){ bool selfRequired = QCoreApplicationPrivate::threadRequiresCoreApplication(); if (!self && selfRequired) return false; // Make it possible for Qt Script to hook into events even // though QApplication is subclassed... bool result = false; void *cbdata[] = { receiver, event, &result }; if (QInternal::activateCallbacks(QInternal::EventNotifyCallback, cbdata)) { return result; } // Qt enforces the rule that events can only be sent to objects in // the current thread, so receiver->d_func()->threadData is // equivalent to QThreadData::current(), just without the function // call overhead. QObjectPrivate *d = receiver->d_func();==> QThreadData *threadData = d->threadData; QScopedScopeLevelCounter scopeLevelCounter(threadData); if (!selfRequired) return doNotify(receiver, event); return self->notify(receiver, event);}
Локальные переменные cbdata @0x1007c500 void*[3] [0] 0x10d897d0 void* [1] 0x1007c5a0 void* [2] 0x1007c51f void* d 0xabababababababab QObjectPrivate* event @0x1007c5a0 QTimerEvent [QEvent] @0x1007c5a0 QEvent id 28 int receiver @0x10d897d0 QObject [vptr] _vptr.QObject d_ptr 12370169555311111083 QScopedPointer<QObjectData> staticMetaObject @0x6bbbdfc0 QMetaObject staticQtMetaObject @0x6bbbe240 QMetaObject result false bool scopeLevelCounter <оптимизировано> selfRequired true bool Инспектор Выражения Возвращаемое значение Подсказка doNotify 9892236762171331414 bool (QObject *, QEvent *) threadData <no such value>
C++ (Qt) // сервис архива archiving->moveToThread(&archivingThread); QObject::connect(&archivingThread, &QThread::finished, archiving, &CServiceArchives::deleteLater); QObject::connect(this, &CServiceManagement::serviceArchiveSig, archiving, &CServiceArchives::serviceRunSlot); QObject::connect(archiving, &CServiceBase::stateChangedSig, this, &CServiceManagement::servStateChangedSlot); archivingThread.setObjectName("archiving"); archivingThread.start();
bool MyApp::notify(QObject *object, QEvent *event){ ... return QGUIApplication::notify(object, event);}
C++ (Qt)QObject::connect(&archivingThread, &QThread::finished, archiving, &CServiceArchives::deleteLater);
C++ (Qt)CModbusInterface::CModbusInterface(...) {... // modbusDevice = new QModbusRtuClient(this);...} CModbusInterface::~CModbusInterface(){ if (modbusDevice) { modbusDevice->deleteLater(); }}