summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp12
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/corelib/kernel/qvariant.h2
4 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index b7ac6aa594..bda25c301e 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -74,7 +74,7 @@ QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &
void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
{
Q_ASSERT(data);
- Q_ASSERT(data->ref == 0);
+ Q_ASSERT(data->ref.load() == 0);
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(data->model);
// a valid persistent model index with a null model pointer can only happen if the model was destroyed
if (model) {
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 4c969c8f4a..555bfa674d 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -807,19 +807,19 @@ QObject::~QObject()
QObjectPrivate::clearGuards(this);
}
- if (d->sharedRefcount) {
- if (d->sharedRefcount->strongref.load() > 0) {
+ QtSharedPointer::ExternalRefCountData *sharedRefcount = d->sharedRefcount.load();
+ if (sharedRefcount) {
+ if (sharedRefcount->strongref.load() > 0) {
qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash.");
// but continue deleting, it's too late to stop anyway
}
// indicate to all QWeakPointers that this QObject has now been deleted
- d->sharedRefcount->strongref.store(0);
- if (!d->sharedRefcount->weakref.deref())
- delete d->sharedRefcount;
+ sharedRefcount->strongref.store(0);
+ if (!sharedRefcount->weakref.deref())
+ delete sharedRefcount;
}
-
if (d->isSignalConnected(0)) {
QT_TRY {
emit destroyed(this);
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 76957f106a..470be1c0b0 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1823,7 +1823,7 @@ QVariant& QVariant::operator=(const QVariant &variant)
void QVariant::detach()
{
- if (!d.is_shared || d.data.shared->ref == 1)
+ if (!d.is_shared || d.data.shared->ref.load() == 1)
return;
Private dd;
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index e77fc90b92..61dc48ad94 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -448,7 +448,7 @@ Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
#endif
inline bool QVariant::isDetached() const
-{ return !d.is_shared || d.data.shared->ref == 1; }
+{ return !d.is_shared || d.data.shared->ref.load() == 1; }
#ifdef qdoc