pre-conditions: lock may or may not be held already, our thread
| 572 | |
| 573 | // pre-conditions: lock may or may not be held already, our thread |
| 574 | void Probe::processQueuedObjectChanges() |
| 575 | { |
| 576 | QMutexLocker lock(s_lock()); |
| 577 | |
| 578 | IF_DEBUG(cout << Q_FUNC_INFO << " " << m_queuedObjectChanges.size() << endl;) |
| 579 | |
| 580 | // must be called from the main thread via timeout |
| 581 | Q_ASSERT(QThread::currentThread() == thread()); |
| 582 | |
| 583 | const auto queuedObjectChanges = m_queuedObjectChanges; // copy, in case this gets modified while we iterate (which can actually happen) |
| 584 | for (const auto &change : queuedObjectChanges) { |
| 585 | switch (change.type) { |
| 586 | case ObjectChange::Create: |
| 587 | objectFullyConstructed(change.obj); |
| 588 | break; |
| 589 | case ObjectChange::Destroy: |
| 590 | emit objectDestroyed(change.obj); |
| 591 | break; |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | IF_DEBUG(cout << Q_FUNC_INFO << " done" << endl;) |
| 596 | |
| 597 | m_queuedObjectChanges.clear(); |
| 598 | |
| 599 | for (QObject *obj : std::as_const(m_pendingReparents)) { |
| 600 | if (!isValidObject(obj)) |
| 601 | continue; |
| 602 | if (filterObject(obj)) // the move might have put it under a hidden parent |
| 603 | objectRemoved(obj); |
| 604 | else |
| 605 | emit objectReparented(obj); |
| 606 | } |
| 607 | m_pendingReparents.clear(); |
| 608 | } |
| 609 | |
| 610 | // pre-condition: lock is held already, our thread |
| 611 | void Probe::objectFullyConstructed(QObject *obj) |
nothing calls this directly
no test coverage detected