| 374 | } |
| 375 | |
| 376 | void TimerModel::postSignalActivate(QObject *caller, int methodIndex) |
| 377 | { |
| 378 | // We are in the thread of the caller emitting the signal |
| 379 | // The probe did unlock the objectLock at this point again but validated caller |
| 380 | Q_ASSERT(TimerModel::isInitialized()); |
| 381 | |
| 382 | if (!canHandleCaller(caller, methodIndex)) |
| 383 | return; |
| 384 | |
| 385 | QMutexLocker locker(&m_mutex); |
| 386 | const TimerId id(caller); |
| 387 | auto it = m_gatheredTimersData.find(id); |
| 388 | |
| 389 | if (it == m_gatheredTimersData.end()) { |
| 390 | // A postSignalActivate can be triggered without a preSignalActivate first |
| 391 | // and/or the caller is not yet gathered. |
| 392 | return; |
| 393 | } |
| 394 | |
| 395 | if (methodIndex != m_qmlTimerRunningChangedIndex) { |
| 396 | if (!it.value().functionCallTimer.isValid()) { |
| 397 | cout << "TimerModel::postSignalActivate(): Timer not active: " |
| 398 | << ( void * )caller << "!" << endl; |
| 399 | return; |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | // safe, nobody in this thread had a chance to delete caller since Probe validated it |
| 404 | it.value().update(id); |
| 405 | |
| 406 | if (methodIndex != m_qmlTimerRunningChangedIndex) { |
| 407 | const TimeoutEvent timeoutEvent(QTime::currentTime(), it.value().functionCallTimer.nsecsElapsed() / 1000); // expected unit is µs |
| 408 | it.value().addEvent(timeoutEvent); |
| 409 | it.value().functionCallTimer.invalidate(); |
| 410 | } |
| 411 | |
| 412 | checkDispatcherStatus(caller); |
| 413 | m_triggerPushChangesMethod.invoke(this, Qt::QueuedConnection); |
| 414 | } |
| 415 | |
| 416 | void TimerModel::setSourceModel(QAbstractItemModel *sourceModel) |
| 417 | { |
no test coverage detected