| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | void QtSharedPointer::ExternalRefCountData::setQObjectShared(const QObject *, bool) | - |
| 14 | {} | - |
| 15 | void QtSharedPointer::ExternalRefCountData::checkQObjectShared(const QObject *) | - |
| 16 | { | - |
| 17 | if (strongref.load() < 0) evaluated: strongref.load() < 0| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 18 | QMessageLogger("tools/qsharedpointer.cpp", 1199, __PRETTY_FUNCTION__).warning("QSharedPointer: cannot create a QSharedPointer from a QObject-tracking QWeakPointer"); executed: QMessageLogger("tools/qsharedpointer.cpp", 1199, __PRETTY_FUNCTION__).warning("QSharedPointer: cannot create a QSharedPointer from a QObject-tracking QWeakPointer");Execution Count:2 | 2 |
| 19 | } executed: }Execution Count:6 | 6 |
| 20 | | - |
| 21 | QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::getAndRef(const QObject *obj) | - |
| 22 | { | - |
| 23 | qt_noop(); | - |
| 24 | QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj)); | - |
| 25 | qt_noop(); | - |
| 26 | | - |
| 27 | ExternalRefCountData *that = d->sharedRefcount.load(); | - |
| 28 | if (that) { evaluated: that| yes Evaluation Count:120967 | yes Evaluation Count:40710 |
| 40710-120967 |
| 29 | that->weakref.ref(); | - |
| 30 | return that; executed: return that;Execution Count:120967 | 120967 |
| 31 | } | - |
| 32 | | - |
| 33 | | - |
| 34 | ExternalRefCountData *x = new ExternalRefCountData(Qt::Uninitialized); | - |
| 35 | x->strongref.store(-1); | - |
| 36 | x->weakref.store(2); | - |
| 37 | if (!d->sharedRefcount.testAndSetRelease(0, x)) { partially evaluated: !d->sharedRefcount.testAndSetRelease(0, x)| no Evaluation Count:0 | yes Evaluation Count:40711 |
| 0-40711 |
| 38 | delete x; | - |
| 39 | x = d->sharedRefcount.loadAcquire(); | - |
| 40 | x->weakref.ref(); | - |
| 41 | } | 0 |
| 42 | return x; executed: return x;Execution Count:40710 | 40710 |
| 43 | } | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | | - |
| 50 | QSharedPointer<QObject> QtSharedPointer::sharedPointerFromVariant_internal(const QVariant &variant) | - |
| 51 | { | - |
| 52 | qt_noop(); | - |
| 53 | return *reinterpret_cast<const QSharedPointer<QObject>*>(variant.constData()); executed: return *reinterpret_cast<const QSharedPointer<QObject>*>(variant.constData());Execution Count:8 | 8 |
| 54 | } | - |
| 55 | | - |
| 56 | | - |
| 57 | | - |
| 58 | | - |
| 59 | | - |
| 60 | | - |
| 61 | QWeakPointer<QObject> QtSharedPointer::weakPointerFromVariant_internal(const QVariant &variant) | - |
| 62 | { | - |
| 63 | qt_noop(); | - |
| 64 | return *reinterpret_cast<const QWeakPointer<QObject>*>(variant.constData()); executed: return *reinterpret_cast<const QWeakPointer<QObject>*>(variant.constData());Execution Count:21 | 21 |
| 65 | } | - |
| 66 | | - |
| 67 | | - |
| 68 | namespace { | - |
| 69 | | - |
| 70 | struct Data { | - |
| 71 | const volatile void *pointer; | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | }; | - |
| 76 | | - |
| 77 | class KnownPointers | - |
| 78 | { | - |
| 79 | public: | - |
| 80 | QMutex mutex; | - |
| 81 | QHash<const void *, Data> dPointers; | - |
| 82 | QHash<const volatile void *, const void *> dataPointers; | - |
| 83 | }; | - |
| 84 | } | - |
| 85 | | - |
| 86 | static KnownPointers *knownPointers() { static QGlobalStatic<KnownPointers > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { KnownPointers *x = new KnownPointers; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<KnownPointers > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:1 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:1 | yes Evaluation Count:227 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:1 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:228 | 0-228 |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | namespace QtSharedPointer { | - |
| 91 | void internalSafetyCheckCleanCheck(); | - |
| 92 | } | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | void QtSharedPointer::internalSafetyCheckAdd(const void *d_ptr, const volatile void *ptr) | - |
| 98 | { | - |
| 99 | KnownPointers *const kp = knownPointers(); | - |
| 100 | if (!kp) partially evaluated: !kp| no Evaluation Count:0 | yes Evaluation Count:114 |
| 0-114 |
| 101 | return; | 0 |
| 102 | | - |
| 103 | QMutexLocker lock(&kp->mutex); | - |
| 104 | qt_noop(); | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | const void *other_d_ptr = kp->dataPointers.value(ptr, 0); | - |
| 109 | if (other_d_ptr) { partially evaluated: other_d_ptr| no Evaluation Count:0 | yes Evaluation Count:114 |
| 0-114 |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | QMessageLogger("tools/qsharedpointer.cpp", 1382, __PRETTY_FUNCTION__).fatal("QSharedPointer: internal self-check failed: pointer %p was already tracked " | - |
| 114 | "by another QSharedPointer object %p", ptr, other_d_ptr); | - |
| 115 | } | 0 |
| 116 | | - |
| 117 | Data data; | - |
| 118 | data.pointer = ptr; | - |
| 119 | | - |
| 120 | | - |
| 121 | | - |
| 122 | | - |
| 123 | kp->dPointers.insert(d_ptr, data); | - |
| 124 | kp->dataPointers.insert(ptr, d_ptr); | - |
| 125 | qt_noop(); | - |
| 126 | } executed: }Execution Count:114 | 114 |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | void QtSharedPointer::internalSafetyCheckRemove(const void *d_ptr) | - |
| 132 | { | - |
| 133 | KnownPointers *const kp = knownPointers(); | - |
| 134 | if (!kp) partially evaluated: !kp| no Evaluation Count:0 | yes Evaluation Count:114 |
| 0-114 |
| 135 | return; | 0 |
| 136 | | - |
| 137 | QMutexLocker lock(&kp->mutex); | - |
| 138 | | - |
| 139 | QHash<const void *, Data>::iterator it = kp->dPointers.find(d_ptr); | - |
| 140 | if (it == kp->dPointers.end()) { partially evaluated: it == kp->dPointers.end()| no Evaluation Count:0 | yes Evaluation Count:114 |
| 0-114 |
| 141 | QMessageLogger("tools/qsharedpointer.cpp", 1410, __PRETTY_FUNCTION__).fatal("QSharedPointer: internal self-check inconsistency: pointer %p was not tracked. " | - |
| 142 | "To use QT_SHAREDPOINTER_TRACK_POINTERS, you have to enable it throughout " | - |
| 143 | "in your code.", d_ptr); | - |
| 144 | } | 0 |
| 145 | | - |
| 146 | QHash<const volatile void *, const void *>::iterator it2 = kp->dataPointers.find(it->pointer); | - |
| 147 | qt_noop(); | - |
| 148 | | - |
| 149 | | - |
| 150 | | - |
| 151 | | - |
| 152 | kp->dataPointers.erase(it2); | - |
| 153 | kp->dPointers.erase(it); | - |
| 154 | qt_noop(); | - |
| 155 | } executed: }Execution Count:114 | 114 |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | | - |
| 161 | void QtSharedPointer::internalSafetyCheckCleanCheck() | - |
| 162 | { | - |
| 163 | } | - |
| 164 | | - |
| 165 | | - |
| 166 | | - |
| | |