MCPcopy Create free account
hub / github.com/KDAB/GammaRay / objectRemoved

Method objectRemoved

core/probe.cpp:654–693  ·  view source on GitHub ↗

* We have two cases to consider here: * (1) our thread: * - emit objectDestroyed() right away * (2) other thread: * - post information to our thread, emit objectDestroyed() there * * pre-conditions: arbitrary thread, lock may or may not be held already */

Source from the content-addressed store, hash-verified

652 * pre-conditions: arbitrary thread, lock may or may not be held already
653 */
654void Probe::objectRemoved(QObject *obj)
655{
656 QMutexLocker lock(s_lock());
657
658 if (!isInitialized()) {
659 IF_DEBUG(cout
660 << "objectRemoved Before: "
661 << hex << obj
662 << " have statics: " << s_listener() << endl;)
663
664 if (!s_listener())
665 return;
666
667 QVector<QObject *> &addedBefore = s_listener()->addedBeforeProbeInstance;
668 for (auto it = addedBefore.begin(); it != addedBefore.end();) {
669 if (*it == obj)
670 it = addedBefore.erase(it);
671 else
672 ++it;
673 }
674 return;
675 }
676
677 IF_DEBUG(cout << "object removed:" << hex << obj << " " << obj->parent() << endl;)
678
679 bool success = instance()->m_validObjects.remove(obj);
680 if (!success) {
681 // object was not tracked by the probe, probably a gammaray object
682 EXPENSIVE_ASSERT(!instance()->isObjectCreationQueued(obj));
683 return;
684 }
685
686 instance()->purgeChangesForObject(obj);
687 EXPENSIVE_ASSERT(!instance()->isObjectCreationQueued(obj));
688
689 if (instance()->thread() == QThread::currentThread())
690 emit instance()->objectDestroyed(obj);
691 else
692 instance()->queueDestroyedObject(obj);
693}
694
695void Probe::handleObjectDestroyed(QObject *obj)
696{

Callers

nothing calls this directly

Calls 8

endMethod · 0.80
purgeChangesForObjectMethod · 0.80
queueDestroyedObjectMethod · 0.80
beginMethod · 0.45
parentMethod · 0.45
removeMethod · 0.45
objectDestroyedMethod · 0.45

Tested by

no test coverage detected