Replace implicit QAtomic* casts with explicit load()/store()
Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
434824aede
commit
6476ac738c
@ -416,7 +416,7 @@ QFutureInterfaceBase &QFutureInterfaceBase::operator=(const QFutureInterfaceBase
|
|||||||
|
|
||||||
bool QFutureInterfaceBase::referenceCountIsOne() const
|
bool QFutureInterfaceBase::referenceCountIsOne() const
|
||||||
{
|
{
|
||||||
return d->refCount == 1;
|
return d->refCount.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
|
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
|
||||||
|
@ -464,7 +464,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
|
|||||||
|
|
||||||
emit q->resultsReadyAt(beginIndex, endIndex);
|
emit q->resultsReadyAt(beginIndex, endIndex);
|
||||||
|
|
||||||
if (int(resultAtConnected) <= 0)
|
if (resultAtConnected.load() <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (int i = beginIndex; i < endIndex; ++i)
|
for (int i = beginIndex; i < endIndex; ++i)
|
||||||
|
@ -214,9 +214,9 @@ public:
|
|||||||
bool shouldStartThread()
|
bool shouldStartThread()
|
||||||
{
|
{
|
||||||
if (forIteration)
|
if (forIteration)
|
||||||
return (currentIndex < iterationCount) && !this->shouldThrottleThread();
|
return (currentIndex.load() < iterationCount) && !this->shouldThrottleThread();
|
||||||
else // whileIteration
|
else // whileIteration
|
||||||
return (iteratorThreads == 0);
|
return (iteratorThreads.load() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadFunctionResult threadFunction()
|
ThreadFunctionResult threadFunction()
|
||||||
@ -238,7 +238,7 @@ public:
|
|||||||
|
|
||||||
const int currentBlockSize = blockSizeManager.blockSize();
|
const int currentBlockSize = blockSizeManager.blockSize();
|
||||||
|
|
||||||
if (currentIndex >= iterationCount)
|
if (currentIndex.load() >= iterationCount)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Atomically reserve a block of iterationCount for this thread.
|
// Atomically reserve a block of iterationCount for this thread.
|
||||||
@ -269,7 +269,7 @@ public:
|
|||||||
// Report progress if progress reporting enabled.
|
// Report progress if progress reporting enabled.
|
||||||
if (progressReportingEnabled) {
|
if (progressReportingEnabled) {
|
||||||
completed.fetchAndAddAcquire(finalBlockSize);
|
completed.fetchAndAddAcquire(finalBlockSize);
|
||||||
this->setProgressValue(this->completed);
|
this->setProgressValue(this->completed.load());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->shouldThrottleThread())
|
if (this->shouldThrottleThread())
|
||||||
|
@ -53,7 +53,7 @@ ThreadEngineBarrier::ThreadEngineBarrier()
|
|||||||
void ThreadEngineBarrier::acquire()
|
void ThreadEngineBarrier::acquire()
|
||||||
{
|
{
|
||||||
forever {
|
forever {
|
||||||
int localCount = int(count);
|
int localCount = count.load();
|
||||||
if (localCount < 0) {
|
if (localCount < 0) {
|
||||||
if (count.testAndSetOrdered(localCount, localCount -1))
|
if (count.testAndSetOrdered(localCount, localCount -1))
|
||||||
return;
|
return;
|
||||||
@ -67,7 +67,7 @@ void ThreadEngineBarrier::acquire()
|
|||||||
int ThreadEngineBarrier::release()
|
int ThreadEngineBarrier::release()
|
||||||
{
|
{
|
||||||
forever {
|
forever {
|
||||||
int localCount = int(count);
|
int localCount = count.load();
|
||||||
if (localCount == -1) {
|
if (localCount == -1) {
|
||||||
if (count.testAndSetOrdered(-1, 0)) {
|
if (count.testAndSetOrdered(-1, 0)) {
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
@ -87,7 +87,7 @@ int ThreadEngineBarrier::release()
|
|||||||
void ThreadEngineBarrier::wait()
|
void ThreadEngineBarrier::wait()
|
||||||
{
|
{
|
||||||
forever {
|
forever {
|
||||||
int localCount = int(count);
|
int localCount = count.load();
|
||||||
if (localCount == 0)
|
if (localCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ void ThreadEngineBarrier::wait()
|
|||||||
|
|
||||||
int ThreadEngineBarrier::currentCount()
|
int ThreadEngineBarrier::currentCount()
|
||||||
{
|
{
|
||||||
return int(count);
|
return count.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
// releases a thread, unless this is the last thread.
|
// releases a thread, unless this is the last thread.
|
||||||
@ -109,7 +109,7 @@ int ThreadEngineBarrier::currentCount()
|
|||||||
bool ThreadEngineBarrier::releaseUnlessLast()
|
bool ThreadEngineBarrier::releaseUnlessLast()
|
||||||
{
|
{
|
||||||
forever {
|
forever {
|
||||||
int localCount = int(count);
|
int localCount = count.load();
|
||||||
if (qAbs(localCount) == 1) {
|
if (qAbs(localCount) == 1) {
|
||||||
return false;
|
return false;
|
||||||
} else if (localCount < 0) {
|
} else if (localCount < 0) {
|
||||||
|
@ -184,7 +184,7 @@ public:
|
|||||||
|
|
||||||
template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
|
template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
|
||||||
{
|
{
|
||||||
if (d && d->ref == 1)
|
if (d && d->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
QProcessEnvironmentPrivate *x = (d ? new QProcessEnvironmentPrivate(*d)
|
QProcessEnvironmentPrivate *x = (d ? new QProcessEnvironmentPrivate(*d)
|
||||||
: new QProcessEnvironmentPrivate);
|
: new QProcessEnvironmentPrivate);
|
||||||
|
@ -6102,7 +6102,7 @@ void QUrl::detach()
|
|||||||
*/
|
*/
|
||||||
bool QUrl::isDetached() const
|
bool QUrl::isDetached() const
|
||||||
{
|
{
|
||||||
return !d || d->ref == 1;
|
return !d || d->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &
|
|||||||
void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
|
void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
|
||||||
{
|
{
|
||||||
Q_ASSERT(data);
|
Q_ASSERT(data);
|
||||||
Q_ASSERT(data->ref == 0);
|
Q_ASSERT(data->ref.load() == 0);
|
||||||
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(data->model);
|
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
|
// a valid persistent model index with a null model pointer can only happen if the model was destroyed
|
||||||
if (model) {
|
if (model) {
|
||||||
|
@ -807,19 +807,19 @@ QObject::~QObject()
|
|||||||
QObjectPrivate::clearGuards(this);
|
QObjectPrivate::clearGuards(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->sharedRefcount) {
|
QtSharedPointer::ExternalRefCountData *sharedRefcount = d->sharedRefcount.load();
|
||||||
if (d->sharedRefcount->strongref.load() > 0) {
|
if (sharedRefcount) {
|
||||||
|
if (sharedRefcount->strongref.load() > 0) {
|
||||||
qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash.");
|
qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash.");
|
||||||
// but continue deleting, it's too late to stop anyway
|
// but continue deleting, it's too late to stop anyway
|
||||||
}
|
}
|
||||||
|
|
||||||
// indicate to all QWeakPointers that this QObject has now been deleted
|
// indicate to all QWeakPointers that this QObject has now been deleted
|
||||||
d->sharedRefcount->strongref.store(0);
|
sharedRefcount->strongref.store(0);
|
||||||
if (!d->sharedRefcount->weakref.deref())
|
if (!sharedRefcount->weakref.deref())
|
||||||
delete d->sharedRefcount;
|
delete sharedRefcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (d->isSignalConnected(0)) {
|
if (d->isSignalConnected(0)) {
|
||||||
QT_TRY {
|
QT_TRY {
|
||||||
emit destroyed(this);
|
emit destroyed(this);
|
||||||
|
@ -1823,7 +1823,7 @@ QVariant& QVariant::operator=(const QVariant &variant)
|
|||||||
|
|
||||||
void QVariant::detach()
|
void QVariant::detach()
|
||||||
{
|
{
|
||||||
if (!d.is_shared || d.data.shared->ref == 1)
|
if (!d.is_shared || d.data.shared->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Private dd;
|
Private dd;
|
||||||
|
@ -448,7 +448,7 @@ Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline bool QVariant::isDetached() const
|
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
|
#ifdef qdoc
|
||||||
|
@ -259,7 +259,7 @@ inline void qAtomicAssign(T *&d, T *x)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline void qAtomicDetach(T *&d)
|
inline void qAtomicDetach(T *&d)
|
||||||
{
|
{
|
||||||
if (d->ref == 1)
|
if (d->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
T *x = d;
|
T *x = d;
|
||||||
d = new T(*d);
|
d = new T(*d);
|
||||||
|
@ -154,7 +154,7 @@ QMutex::~QMutex()
|
|||||||
delete static_cast<QRecursiveMutexPrivate *>(d.load());
|
delete static_cast<QRecursiveMutexPrivate *>(d.load());
|
||||||
else if (d.load()) {
|
else if (d.load()) {
|
||||||
#ifndef Q_OS_LINUX
|
#ifndef Q_OS_LINUX
|
||||||
if (d.load()->possiblyUnlocked && tryLock()) { unlock(); return; }
|
if (d.load()->possiblyUnlocked.load() && tryLock()) { unlock(); return; }
|
||||||
#endif
|
#endif
|
||||||
qWarning("QMutex: destroying locked mutex");
|
qWarning("QMutex: destroying locked mutex");
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ bool QBasicMutex::lockInternal(int timeout)
|
|||||||
return static_cast<QRecursiveMutexPrivate *>(d)->lock(timeout);
|
return static_cast<QRecursiveMutexPrivate *>(d)->lock(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout == 0 && !d->possiblyUnlocked)
|
if (timeout == 0 && !d->possiblyUnlocked.load())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!d->ref())
|
if (!d->ref())
|
||||||
@ -375,7 +375,7 @@ bool QBasicMutex::lockInternal(int timeout)
|
|||||||
|
|
||||||
int old_waiters;
|
int old_waiters;
|
||||||
do {
|
do {
|
||||||
old_waiters = d->waiters;
|
old_waiters = d->waiters.load();
|
||||||
if (old_waiters == -QMutexPrivate::BigNumber) {
|
if (old_waiters == -QMutexPrivate::BigNumber) {
|
||||||
// we are unlocking, and the thread that unlocks is about to change d to 0
|
// we are unlocking, and the thread that unlocks is about to change d to 0
|
||||||
// we try to aquire the mutex by changing to dummyLocked()
|
// we try to aquire the mutex by changing to dummyLocked()
|
||||||
@ -407,7 +407,7 @@ bool QBasicMutex::lockInternal(int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d->wait(timeout)) {
|
if (d->wait(timeout)) {
|
||||||
if (d->possiblyUnlocked && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
if (d->possiblyUnlocked.load() && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
||||||
d->deref();
|
d->deref();
|
||||||
d->derefWaiters(1);
|
d->derefWaiters(1);
|
||||||
//we got the lock. (do not deref)
|
//we got the lock. (do not deref)
|
||||||
@ -445,7 +445,7 @@ void QBasicMutex::unlockInternal()
|
|||||||
if (d->waiters.fetchAndAddRelease(-QMutexPrivate::BigNumber) == 0) {
|
if (d->waiters.fetchAndAddRelease(-QMutexPrivate::BigNumber) == 0) {
|
||||||
//there is no one waiting on this mutex anymore, set the mutex as unlocked (d = 0)
|
//there is no one waiting on this mutex anymore, set the mutex as unlocked (d = 0)
|
||||||
if (this->d.testAndSetRelease(d, 0)) {
|
if (this->d.testAndSetRelease(d, 0)) {
|
||||||
if (d->possiblyUnlocked && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
if (d->possiblyUnlocked.load() && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
||||||
d->deref();
|
d->deref();
|
||||||
}
|
}
|
||||||
d->derefWaiters(0);
|
d->derefWaiters(0);
|
||||||
@ -479,10 +479,10 @@ QMutexPrivate *QMutexPrivate::allocate()
|
|||||||
int i = freelist()->next();
|
int i = freelist()->next();
|
||||||
QMutexPrivate *d = &(*freelist())[i];
|
QMutexPrivate *d = &(*freelist())[i];
|
||||||
d->id = i;
|
d->id = i;
|
||||||
Q_ASSERT(d->refCount == 0);
|
Q_ASSERT(d->refCount.load() == 0);
|
||||||
Q_ASSERT(!d->recursive);
|
Q_ASSERT(!d->recursive);
|
||||||
Q_ASSERT(!d->possiblyUnlocked);
|
Q_ASSERT(!d->possiblyUnlocked.load());
|
||||||
Q_ASSERT(d->waiters == 0);
|
Q_ASSERT(d->waiters.load() == 0);
|
||||||
d->refCount = 1;
|
d->refCount = 1;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@ -490,9 +490,9 @@ QMutexPrivate *QMutexPrivate::allocate()
|
|||||||
void QMutexPrivate::release()
|
void QMutexPrivate::release()
|
||||||
{
|
{
|
||||||
Q_ASSERT(!recursive);
|
Q_ASSERT(!recursive);
|
||||||
Q_ASSERT(refCount == 0);
|
Q_ASSERT(refCount.load() == 0);
|
||||||
Q_ASSERT(!possiblyUnlocked);
|
Q_ASSERT(!possiblyUnlocked.load());
|
||||||
Q_ASSERT(waiters == 0);
|
Q_ASSERT(waiters.load() == 0);
|
||||||
freelist()->release(id);
|
freelist()->release(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ void QMutexPrivate::derefWaiters(int value)
|
|||||||
int old_waiters;
|
int old_waiters;
|
||||||
int new_waiters;
|
int new_waiters;
|
||||||
do {
|
do {
|
||||||
old_waiters = waiters;
|
old_waiters = waiters.load();
|
||||||
new_waiters = old_waiters;
|
new_waiters = old_waiters;
|
||||||
if (new_waiters < 0) {
|
if (new_waiters < 0) {
|
||||||
new_waiters += QMutexPrivate::BigNumber;
|
new_waiters += QMutexPrivate::BigNumber;
|
||||||
|
@ -79,21 +79,21 @@ public:
|
|||||||
int id;
|
int id;
|
||||||
|
|
||||||
bool ref() {
|
bool ref() {
|
||||||
Q_ASSERT(refCount >= 0);
|
Q_ASSERT(refCount.load() >= 0);
|
||||||
int c;
|
int c;
|
||||||
do {
|
do {
|
||||||
c = refCount;
|
c = refCount.load();
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return false;
|
return false;
|
||||||
} while (!refCount.testAndSetRelaxed(c, c + 1));
|
} while (!refCount.testAndSetRelaxed(c, c + 1));
|
||||||
Q_ASSERT(refCount >= 0);
|
Q_ASSERT(refCount.load() >= 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void deref() {
|
void deref() {
|
||||||
Q_ASSERT(refCount >=0);
|
Q_ASSERT(refCount.load() >= 0);
|
||||||
if (!refCount.deref())
|
if (!refCount.deref())
|
||||||
release();
|
release();
|
||||||
Q_ASSERT(refCount >=0);
|
Q_ASSERT(refCount.load() >= 0);
|
||||||
}
|
}
|
||||||
void release();
|
void release();
|
||||||
static QMutexPrivate *allocate();
|
static QMutexPrivate *allocate();
|
||||||
|
@ -99,7 +99,7 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size)
|
|||||||
: mutexes(size), recursionMode(recursionMode)
|
: mutexes(size), recursionMode(recursionMode)
|
||||||
{
|
{
|
||||||
for (int index = 0; index < mutexes.count(); ++index) {
|
for (int index = 0; index < mutexes.count(); ++index) {
|
||||||
mutexes[index] = 0;
|
mutexes[index].store(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,10 +109,8 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size)
|
|||||||
*/
|
*/
|
||||||
QMutexPool::~QMutexPool()
|
QMutexPool::~QMutexPool()
|
||||||
{
|
{
|
||||||
for (int index = 0; index < mutexes.count(); ++index) {
|
for (int index = 0; index < mutexes.count(); ++index)
|
||||||
delete mutexes[index];
|
delete mutexes[index].load();
|
||||||
mutexes[index] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -136,9 +134,9 @@ QMutex *QMutexPool::createMutex(int index)
|
|||||||
{
|
{
|
||||||
// mutex not created, create one
|
// mutex not created, create one
|
||||||
QMutex *newMutex = new QMutex(recursionMode);
|
QMutex *newMutex = new QMutex(recursionMode);
|
||||||
if (!mutexes[index].testAndSetOrdered(0, newMutex))
|
if (!mutexes[index].testAndSetRelease(0, newMutex))
|
||||||
delete newMutex;
|
delete newMutex;
|
||||||
return mutexes[index];
|
return mutexes[index].load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
inline QMutex *get(const void *address) {
|
inline QMutex *get(const void *address) {
|
||||||
int index = uint(quintptr(address)) % mutexes.count();
|
int index = uint(quintptr(address)) % mutexes.count();
|
||||||
QMutex *m = mutexes[index];
|
QMutex *m = mutexes[index].load();
|
||||||
if (m)
|
if (m)
|
||||||
return m;
|
return m;
|
||||||
else
|
else
|
||||||
|
@ -85,7 +85,7 @@ QThreadData::QThreadData(int initialRefCount)
|
|||||||
|
|
||||||
QThreadData::~QThreadData()
|
QThreadData::~QThreadData()
|
||||||
{
|
{
|
||||||
Q_ASSERT(_ref == 0);
|
Q_ASSERT(_ref.load() == 0);
|
||||||
|
|
||||||
// In the odd case that Qt is running on a secondary thread, the main
|
// In the odd case that Qt is running on a secondary thread, the main
|
||||||
// thread instance will have been dereffed asunder because of the deref in
|
// thread instance will have been dereffed asunder because of the deref in
|
||||||
@ -117,7 +117,7 @@ void QThreadData::ref()
|
|||||||
{
|
{
|
||||||
#ifndef QT_NO_THREAD
|
#ifndef QT_NO_THREAD
|
||||||
(void) _ref.ref();
|
(void) _ref.ref();
|
||||||
Q_ASSERT(_ref != 0);
|
Q_ASSERT(_ref.load() != 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1701,7 +1701,7 @@ void QRegExpEngine::dump() const
|
|||||||
|
|
||||||
void QRegExpEngine::setup()
|
void QRegExpEngine::setup()
|
||||||
{
|
{
|
||||||
ref = 1;
|
ref.store(1);
|
||||||
#ifndef QT_NO_REGEXP_CAPTURE
|
#ifndef QT_NO_REGEXP_CAPTURE
|
||||||
f.resize(32);
|
f.resize(32);
|
||||||
nf = 0;
|
nf = 0;
|
||||||
|
@ -1238,9 +1238,9 @@ void QtSharedPointer::ExternalRefCountData::setQObjectShared(const QObject *obj,
|
|||||||
Q_ASSERT(obj);
|
Q_ASSERT(obj);
|
||||||
QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
|
QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
|
||||||
|
|
||||||
if (d->sharedRefcount)
|
if (d->sharedRefcount.load() != 0)
|
||||||
qFatal("QSharedPointer: pointer %p already has reference counting", obj);
|
qFatal("QSharedPointer: pointer %p already has reference counting", obj);
|
||||||
d->sharedRefcount = this;
|
d->sharedRefcount.store(this);
|
||||||
|
|
||||||
// QObject decreases the refcount too, so increase it up
|
// QObject decreases the refcount too, so increase it up
|
||||||
weakref.ref();
|
weakref.ref();
|
||||||
@ -1252,7 +1252,7 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
|||||||
QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
|
QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
|
||||||
Q_ASSERT_X(!d->wasDeleted, "QWeakPointer", "Detected QWeakPointer creation in a QObject being deleted");
|
Q_ASSERT_X(!d->wasDeleted, "QWeakPointer", "Detected QWeakPointer creation in a QObject being deleted");
|
||||||
|
|
||||||
ExternalRefCountData *that = d->sharedRefcount;
|
ExternalRefCountData *that = d->sharedRefcount.load();
|
||||||
if (that) {
|
if (that) {
|
||||||
that->weakref.ref();
|
that->weakref.ref();
|
||||||
return that;
|
return that;
|
||||||
@ -1264,9 +1264,10 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
|||||||
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
|
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
|
||||||
if (!d->sharedRefcount.testAndSetRelease(0, x)) {
|
if (!d->sharedRefcount.testAndSetRelease(0, x)) {
|
||||||
delete x;
|
delete x;
|
||||||
d->sharedRefcount->weakref.ref();
|
x = d->sharedRefcount.loadAcquire();
|
||||||
|
x->weakref.ref();
|
||||||
}
|
}
|
||||||
return d->sharedRefcount.loadAcquire();
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -1075,10 +1075,10 @@ QImage::operator QVariant() const
|
|||||||
void QImage::detach()
|
void QImage::detach()
|
||||||
{
|
{
|
||||||
if (d) {
|
if (d) {
|
||||||
if (d->is_cached && d->ref == 1)
|
if (d->is_cached && d->ref.load() == 1)
|
||||||
QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
|
QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
|
||||||
|
|
||||||
if (d->ref != 1 || d->ro_data)
|
if (d->ref.load() != 1 || d->ro_data)
|
||||||
*this = copy();
|
*this = copy();
|
||||||
|
|
||||||
if (d)
|
if (d)
|
||||||
@ -5289,7 +5289,7 @@ qint64 QImage::cacheKey() const
|
|||||||
|
|
||||||
bool QImage::isDetached() const
|
bool QImage::isDetached() const
|
||||||
{
|
{
|
||||||
return d && d->ref == 1;
|
return d && d->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5849,7 +5849,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// No in-place conversion if we have to detach
|
// No in-place conversion if we have to detach
|
||||||
if (ref > 1)
|
if (ref.load() > 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat];
|
const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat];
|
||||||
|
@ -226,7 +226,7 @@ void QPicture::detach()
|
|||||||
|
|
||||||
bool QPicture::isDetached() const
|
bool QPicture::isDetached() const
|
||||||
{
|
{
|
||||||
return d_func()->ref == 1;
|
return d_func()->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -272,7 +272,7 @@ QPixmap::QPixmap(const char * const xpm[])
|
|||||||
|
|
||||||
QPixmap::~QPixmap()
|
QPixmap::~QPixmap()
|
||||||
{
|
{
|
||||||
Q_ASSERT(!data || data->ref >= 1); // Catch if ref-counting changes again
|
Q_ASSERT(!data || data->ref.load() >= 1); // Catch if ref-counting changes again
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -871,7 +871,7 @@ void QPixmap::fill(const QColor &color)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->ref == 1) {
|
if (data->ref.load() == 1) {
|
||||||
// detach() will also remove this pixmap from caches, so
|
// detach() will also remove this pixmap from caches, so
|
||||||
// it has to be called even when ref == 1.
|
// it has to be called even when ref == 1.
|
||||||
detach();
|
detach();
|
||||||
@ -1000,7 +1000,7 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap)
|
|||||||
|
|
||||||
bool QPixmap::isDetached() const
|
bool QPixmap::isDetached() const
|
||||||
{
|
{
|
||||||
return data && data->ref == 1;
|
return data && data->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
@ -1529,10 +1529,10 @@ void QPixmap::detach()
|
|||||||
rasterData->image.detach();
|
rasterData->image.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->is_cached && data->ref == 1)
|
if (data->is_cached && data->ref.load() == 1)
|
||||||
QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data());
|
QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data());
|
||||||
|
|
||||||
if (data->ref != 1) {
|
if (data->ref.load() != 1) {
|
||||||
*this = copy();
|
*this = copy();
|
||||||
}
|
}
|
||||||
++data->detach_no;
|
++data->detach_no;
|
||||||
|
@ -3761,7 +3761,7 @@ qreal QTouchEvent::TouchPoint::pressure() const
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setId(int id)
|
void QTouchEvent::TouchPoint::setId(int id)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->id = id;
|
d->id = id;
|
||||||
}
|
}
|
||||||
@ -3769,7 +3769,7 @@ void QTouchEvent::TouchPoint::setId(int id)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
|
void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->state = state;
|
d->state = state;
|
||||||
}
|
}
|
||||||
@ -3777,7 +3777,7 @@ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
|
void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->rect.moveCenter(pos);
|
d->rect.moveCenter(pos);
|
||||||
}
|
}
|
||||||
@ -3785,7 +3785,7 @@ void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
|
void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->sceneRect.moveCenter(scenePos);
|
d->sceneRect.moveCenter(scenePos);
|
||||||
}
|
}
|
||||||
@ -3793,7 +3793,7 @@ void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
|
void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->screenRect.moveCenter(screenPos);
|
d->screenRect.moveCenter(screenPos);
|
||||||
}
|
}
|
||||||
@ -3801,7 +3801,7 @@ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
|
void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->normalizedPos = normalizedPos;
|
d->normalizedPos = normalizedPos;
|
||||||
}
|
}
|
||||||
@ -3809,7 +3809,7 @@ void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
|
void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->startPos = startPos;
|
d->startPos = startPos;
|
||||||
}
|
}
|
||||||
@ -3817,7 +3817,7 @@ void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
|
void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->startScenePos = startScenePos;
|
d->startScenePos = startScenePos;
|
||||||
}
|
}
|
||||||
@ -3825,7 +3825,7 @@ void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
|
void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->startScreenPos = startScreenPos;
|
d->startScreenPos = startScreenPos;
|
||||||
}
|
}
|
||||||
@ -3833,7 +3833,7 @@ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos)
|
void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->startNormalizedPos = startNormalizedPos;
|
d->startNormalizedPos = startNormalizedPos;
|
||||||
}
|
}
|
||||||
@ -3841,7 +3841,7 @@ void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormaliz
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
|
void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->lastPos = lastPos;
|
d->lastPos = lastPos;
|
||||||
}
|
}
|
||||||
@ -3849,7 +3849,7 @@ void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
|
void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->lastScenePos = lastScenePos;
|
d->lastScenePos = lastScenePos;
|
||||||
}
|
}
|
||||||
@ -3857,7 +3857,7 @@ void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
|
void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->lastScreenPos = lastScreenPos;
|
d->lastScreenPos = lastScreenPos;
|
||||||
}
|
}
|
||||||
@ -3865,7 +3865,7 @@ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos)
|
void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->lastNormalizedPos = lastNormalizedPos;
|
d->lastNormalizedPos = lastNormalizedPos;
|
||||||
}
|
}
|
||||||
@ -3873,7 +3873,7 @@ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalized
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
|
void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->rect = rect;
|
d->rect = rect;
|
||||||
}
|
}
|
||||||
@ -3881,7 +3881,7 @@ void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
|
void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->sceneRect = sceneRect;
|
d->sceneRect = sceneRect;
|
||||||
}
|
}
|
||||||
@ -3889,7 +3889,7 @@ void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
|
void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->screenRect = screenRect;
|
d->screenRect = screenRect;
|
||||||
}
|
}
|
||||||
@ -3897,7 +3897,7 @@ void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QTouchEvent::TouchPoint::setPressure(qreal pressure)
|
void QTouchEvent::TouchPoint::setPressure(qreal pressure)
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d = d->detach();
|
d = d->detach();
|
||||||
d->pressure = pressure;
|
d->pressure = pressure;
|
||||||
}
|
}
|
||||||
|
@ -1600,7 +1600,7 @@ bool QKeySequence::operator< (const QKeySequence &other) const
|
|||||||
*/
|
*/
|
||||||
bool QKeySequence::isDetached() const
|
bool QKeySequence::isDetached() const
|
||||||
{
|
{
|
||||||
return d->ref == 1;
|
return d->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -544,7 +544,7 @@ QOpenGLMultiGroupSharedResource::~QOpenGLMultiGroupSharedResource()
|
|||||||
active.deref();
|
active.deref();
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
if (active != 0) {
|
if (active.load() != 0) {
|
||||||
qWarning("QtGui: Resources are still available at program shutdown.\n"
|
qWarning("QtGui: Resources are still available at program shutdown.\n"
|
||||||
" This is possibly caused by a leaked QOpenGLWidget, \n"
|
" This is possibly caused by a leaked QOpenGLWidget, \n"
|
||||||
" QOpenGLFramebufferObject or QOpenGLPixelBuffer.");
|
" QOpenGLFramebufferObject or QOpenGLPixelBuffer.");
|
||||||
|
@ -753,7 +753,7 @@ bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const
|
|||||||
*/
|
*/
|
||||||
void QPalette::detach()
|
void QPalette::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QPalettePrivate *x = new QPalettePrivate;
|
QPalettePrivate *x = new QPalettePrivate;
|
||||||
for(int grp = 0; grp < (int)NColorGroups; grp++) {
|
for(int grp = 0; grp < (int)NColorGroups; grp++) {
|
||||||
for(int role = 0; role < (int)NColorRoles; role++)
|
for(int role = 0; role < (int)NColorRoles; role++)
|
||||||
|
@ -120,7 +120,7 @@ QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) :
|
|||||||
*/
|
*/
|
||||||
void QSurfaceFormat::detach()
|
void QSurfaceFormat::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d);
|
QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d);
|
||||||
if (!d->ref.deref())
|
if (!d->ref.deref())
|
||||||
delete d;
|
delete d;
|
||||||
|
@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
*/
|
*/
|
||||||
void QOpenGLFramebufferObjectFormat::detach()
|
void QOpenGLFramebufferObjectFormat::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QOpenGLFramebufferObjectFormatPrivate *newd
|
QOpenGLFramebufferObjectFormatPrivate *newd
|
||||||
= new QOpenGLFramebufferObjectFormatPrivate(d);
|
= new QOpenGLFramebufferObjectFormatPrivate(d);
|
||||||
if (!d->ref.deref())
|
if (!d->ref.deref())
|
||||||
|
@ -343,7 +343,7 @@ public:
|
|||||||
QBrushData *brush;
|
QBrushData *brush;
|
||||||
QNullBrushData() : brush(new QBrushData)
|
QNullBrushData() : brush(new QBrushData)
|
||||||
{
|
{
|
||||||
brush->ref = 1;
|
brush->ref.store(1);
|
||||||
brush->style = Qt::BrushStyle(0);
|
brush->style = Qt::BrushStyle(0);
|
||||||
brush->color = Qt::black;
|
brush->color = Qt::black;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ void QBrush::init(const QColor &color, Qt::BrushStyle style)
|
|||||||
d.reset(new QBrushData);
|
d.reset(new QBrushData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
d->ref = 1;
|
d->ref.store(1);
|
||||||
d->style = style;
|
d->style = style;
|
||||||
d->color = color;
|
d->color = color;
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ void QBrush::cleanUp(QBrushData *x)
|
|||||||
|
|
||||||
void QBrush::detach(Qt::BrushStyle newStyle)
|
void QBrush::detach(Qt::BrushStyle newStyle)
|
||||||
{
|
{
|
||||||
if (newStyle == d->style && d->ref == 1)
|
if (newStyle == d->style && d->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QScopedPointer<QBrushData> x;
|
QScopedPointer<QBrushData> x;
|
||||||
@ -605,7 +605,7 @@ void QBrush::detach(Qt::BrushStyle newStyle)
|
|||||||
x.reset(new QBrushData);
|
x.reset(new QBrushData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
x->ref = 1;
|
x->ref.store(1);
|
||||||
x->style = newStyle;
|
x->style = newStyle;
|
||||||
x->color = d->color;
|
x->color = d->color;
|
||||||
x->transform = d->transform;
|
x->transform = d->transform;
|
||||||
|
@ -174,7 +174,7 @@ inline Qt::BrushStyle QBrush::style() const { return d->style; }
|
|||||||
inline const QColor &QBrush::color() const { return d->color; }
|
inline const QColor &QBrush::color() const { return d->color; }
|
||||||
inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
|
inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
|
||||||
inline QTransform QBrush::transform() const { return d->transform; }
|
inline QTransform QBrush::transform() const { return d->transform; }
|
||||||
inline bool QBrush::isDetached() const { return d->ref == 1; }
|
inline bool QBrush::isDetached() const { return d->ref.load() == 1; }
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -419,7 +419,7 @@ inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
|
|||||||
|
|
||||||
inline void QPainterPath::detach()
|
inline void QPainterPath::detach()
|
||||||
{
|
{
|
||||||
if (d_ptr->ref != 1)
|
if (d_ptr->ref.load() != 1)
|
||||||
detach_helper();
|
detach_helper();
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ inline bool QPainterPathData::isClosed() const
|
|||||||
|
|
||||||
inline void QPainterPathData::close()
|
inline void QPainterPathData::close()
|
||||||
{
|
{
|
||||||
Q_ASSERT(ref == 1);
|
Q_ASSERT(ref.load() == 1);
|
||||||
require_moveTo = true;
|
require_moveTo = true;
|
||||||
const QPainterPath::Element &first = elements.at(cStart);
|
const QPainterPath::Element &first = elements.at(cStart);
|
||||||
QPainterPath::Element &last = elements.last();
|
QPainterPath::Element &last = elements.last();
|
||||||
|
@ -230,10 +230,9 @@ typedef QPenPrivate QPenData;
|
|||||||
*/
|
*/
|
||||||
inline QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle,
|
inline QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle,
|
||||||
Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle)
|
Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle)
|
||||||
: dashOffset(0), miterLimit(2),
|
: ref(1), dashOffset(0), miterLimit(2),
|
||||||
cosmetic(false)
|
cosmetic(false)
|
||||||
{
|
{
|
||||||
ref = 1;
|
|
||||||
width = _width;
|
width = _width;
|
||||||
brush = _brush;
|
brush = _brush;
|
||||||
style = penStyle;
|
style = penStyle;
|
||||||
@ -353,7 +352,7 @@ QPen::~QPen()
|
|||||||
|
|
||||||
void QPen::detach()
|
void QPen::detach()
|
||||||
{
|
{
|
||||||
if (d->ref == 1)
|
if (d->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPenData *x = new QPenData(*static_cast<QPenData *>(d));
|
QPenData *x = new QPenData(*static_cast<QPenData *>(d));
|
||||||
@ -860,7 +859,7 @@ bool QPen::operator==(const QPen &p) const
|
|||||||
|
|
||||||
bool QPen::isDetached()
|
bool QPen::isDetached()
|
||||||
{
|
{
|
||||||
return d->ref == 1;
|
return d->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@ QFont::QFont(QFontPrivate *data)
|
|||||||
*/
|
*/
|
||||||
void QFont::detach()
|
void QFont::detach()
|
||||||
{
|
{
|
||||||
if (d->ref == 1) {
|
if (d->ref.load() == 1) {
|
||||||
if (d->engineData)
|
if (d->engineData)
|
||||||
d->engineData->ref.deref();
|
d->engineData->ref.deref();
|
||||||
d->engineData = 0;
|
d->engineData = 0;
|
||||||
@ -2631,11 +2631,11 @@ QFontCache::~QFontCache()
|
|||||||
EngineDataCache::ConstIterator it = engineDataCache.constBegin(),
|
EngineDataCache::ConstIterator it = engineDataCache.constBegin(),
|
||||||
end = engineDataCache.constEnd();
|
end = engineDataCache.constEnd();
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
if (it.value()->ref == 0)
|
if (it.value()->ref.load() == 0)
|
||||||
delete it.value();
|
delete it.value();
|
||||||
else
|
else
|
||||||
FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d",
|
FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d",
|
||||||
it.value(), int(it.value()->ref));
|
it.value(), it.value()->ref.load());
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2643,7 +2643,7 @@ QFontCache::~QFontCache()
|
|||||||
end = engineCache.constEnd();
|
end = engineCache.constEnd();
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
if (--it.value().data->cache_count == 0) {
|
if (--it.value().data->cache_count == 0) {
|
||||||
if (it.value().data->ref == 0) {
|
if (it.value().data->ref.load() == 0) {
|
||||||
FC_DEBUG("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)",
|
FC_DEBUG("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)",
|
||||||
it.value().data, it.key().script, it.key().def.pointSize,
|
it.value().data, it.key().script, it.key().def.pointSize,
|
||||||
it.key().def.pixelSize, it.key().def.weight, it.key().def.style,
|
it.key().def.pixelSize, it.key().def.weight, it.key().def.style,
|
||||||
@ -2652,7 +2652,7 @@ QFontCache::~QFontCache()
|
|||||||
delete it.value().data;
|
delete it.value().data;
|
||||||
} else {
|
} else {
|
||||||
FC_DEBUG("QFontCache::~QFontCache: engine = %p still has refcount %d",
|
FC_DEBUG("QFontCache::~QFontCache: engine = %p still has refcount %d",
|
||||||
it.value().data, int(it.value().data->ref));
|
it.value().data, it.value().data->ref.load());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
@ -2678,7 +2678,7 @@ void QFontCache::clear()
|
|||||||
|
|
||||||
for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end();
|
for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end();
|
||||||
it != end; ++it) {
|
it != end; ++it) {
|
||||||
if (it->data->ref == 0) {
|
if (it->data->ref.load() == 0) {
|
||||||
delete it->data;
|
delete it->data;
|
||||||
it->data = 0;
|
it->data = 0;
|
||||||
}
|
}
|
||||||
@ -2686,7 +2686,7 @@ void QFontCache::clear()
|
|||||||
|
|
||||||
for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end();
|
for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end();
|
||||||
it != end; ++it) {
|
it != end; ++it) {
|
||||||
if (it->data && it->data->ref == 0) {
|
if (it->data && it->data->ref.load() == 0) {
|
||||||
delete it->data;
|
delete it->data;
|
||||||
it->data = 0;
|
it->data = 0;
|
||||||
}
|
}
|
||||||
@ -2727,7 +2727,7 @@ QFontEngine *QFontCache::findEngine(const Key &key)
|
|||||||
FC_DEBUG("QFontCache: found font engine\n"
|
FC_DEBUG("QFontCache: found font engine\n"
|
||||||
" %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'",
|
" %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'",
|
||||||
it.value().data, it.value().timestamp, it.value().hits,
|
it.value().data, it.value().timestamp, it.value().hits,
|
||||||
int(it.value().data->ref), it.value().data->cache_count,
|
it.value().data->ref.load(), it.value().data->cache_count,
|
||||||
it.value().data->name());
|
it.value().data->name());
|
||||||
|
|
||||||
return it.value().data;
|
return it.value().data;
|
||||||
@ -2782,7 +2782,6 @@ void QFontCache::decreaseCost(uint cost)
|
|||||||
cost, total_cost, max_cost);
|
cost, total_cost, max_cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QFontCache::timerEvent(QTimerEvent *)
|
void QFontCache::timerEvent(QTimerEvent *)
|
||||||
{
|
{
|
||||||
FC_DEBUG("QFontCache::timerEvent: performing cache maintenance (timestamp %u)",
|
FC_DEBUG("QFontCache::timerEvent: performing cache maintenance (timestamp %u)",
|
||||||
@ -2816,7 +2815,7 @@ void QFontCache::timerEvent(QTimerEvent *)
|
|||||||
|
|
||||||
#endif // QFONTCACHE_DEBUG
|
#endif // QFONTCACHE_DEBUG
|
||||||
|
|
||||||
if (it.value()->ref != 0)
|
if (it.value()->ref.load() != 0)
|
||||||
in_use_cost += engine_data_cost;
|
in_use_cost += engine_data_cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2829,10 +2828,10 @@ void QFontCache::timerEvent(QTimerEvent *)
|
|||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes",
|
FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes",
|
||||||
it.value().data, it.value().timestamp, it.value().hits,
|
it.value().data, it.value().timestamp, it.value().hits,
|
||||||
int(it.value().data->ref), it.value().data->cache_count,
|
it.value().data->ref.load(), it.value().data->cache_count,
|
||||||
it.value().data->cache_cost);
|
it.value().data->cache_cost);
|
||||||
|
|
||||||
if (it.value().data->ref != 0)
|
if (it.value().data->ref.load() != 0)
|
||||||
in_use_cost += it.value().data->cache_cost / it.value().data->cache_count;
|
in_use_cost += it.value().data->cache_cost / it.value().data->cache_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2882,7 +2881,7 @@ void QFontCache::timerEvent(QTimerEvent *)
|
|||||||
EngineDataCache::Iterator it = engineDataCache.begin(),
|
EngineDataCache::Iterator it = engineDataCache.begin(),
|
||||||
end = engineDataCache.end();
|
end = engineDataCache.end();
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
if (it.value()->ref != 0) {
|
if (it.value()->ref.load() != 0) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2910,7 +2909,7 @@ void QFontCache::timerEvent(QTimerEvent *)
|
|||||||
uint least_popular = ~0u;
|
uint least_popular = ~0u;
|
||||||
|
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
if (it.value().data->ref != 0)
|
if (it.value().data->ref.load() != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (it.value().timestamp < oldest &&
|
if (it.value().timestamp < oldest &&
|
||||||
@ -2923,7 +2922,7 @@ void QFontCache::timerEvent(QTimerEvent *)
|
|||||||
FC_DEBUG(" oldest %u least popular %u", oldest, least_popular);
|
FC_DEBUG(" oldest %u least popular %u", oldest, least_popular);
|
||||||
|
|
||||||
for (it = engineCache.begin(); it != end; ++it) {
|
for (it = engineCache.begin(); it != end; ++it) {
|
||||||
if (it.value().data->ref == 0 &&
|
if (it.value().data->ref.load() == 0 &&
|
||||||
it.value().timestamp == oldest &&
|
it.value().timestamp == oldest &&
|
||||||
it.value().hits == least_popular)
|
it.value().hits == least_popular)
|
||||||
break;
|
break;
|
||||||
@ -2932,7 +2931,7 @@ void QFontCache::timerEvent(QTimerEvent *)
|
|||||||
if (it != end) {
|
if (it != end) {
|
||||||
FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'",
|
FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'",
|
||||||
it.value().data, it.value().timestamp, it.value().hits,
|
it.value().data, it.value().timestamp, it.value().hits,
|
||||||
int(it.value().data->ref), it.value().data->cache_count,
|
it.value().data->ref.load(), it.value().data->cache_count,
|
||||||
it.value().data->name());
|
it.value().data->name());
|
||||||
|
|
||||||
if (--it.value().data->cache_count == 0) {
|
if (--it.value().data->cache_count == 0) {
|
||||||
|
@ -168,9 +168,8 @@ static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB
|
|||||||
// QFontEngine
|
// QFontEngine
|
||||||
|
|
||||||
QFontEngine::QFontEngine()
|
QFontEngine::QFontEngine()
|
||||||
: QObject()
|
: QObject(), ref(0)
|
||||||
{
|
{
|
||||||
ref = 0;
|
|
||||||
cache_count = 0;
|
cache_count = 0;
|
||||||
fsType = 0;
|
fsType = 0;
|
||||||
symbol = false;
|
symbol = false;
|
||||||
@ -1360,7 +1359,7 @@ QFontEngineMulti::~QFontEngineMulti()
|
|||||||
QFontEngine *fontEngine = engines.at(i);
|
QFontEngine *fontEngine = engines.at(i);
|
||||||
if (fontEngine) {
|
if (fontEngine) {
|
||||||
fontEngine->ref.deref();
|
fontEngine->ref.deref();
|
||||||
if (fontEngine->cache_count == 0 && fontEngine->ref == 0)
|
if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0)
|
||||||
delete fontEngine;
|
delete fontEngine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ QGlyphRun::~QGlyphRun()
|
|||||||
*/
|
*/
|
||||||
void QGlyphRun::detach()
|
void QGlyphRun::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1)
|
if (d->ref.load() != 1)
|
||||||
d.detach();
|
d.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ QSupportedWritingSystems::~QSupportedWritingSystems()
|
|||||||
*/
|
*/
|
||||||
void QSupportedWritingSystems::detach()
|
void QSupportedWritingSystems::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d);
|
QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d);
|
||||||
if (!d->ref.deref())
|
if (!d->ref.deref())
|
||||||
delete d;
|
delete d;
|
||||||
|
@ -683,7 +683,7 @@ void QRawFont::setPixelSize(qreal pixelSize)
|
|||||||
d->fontEngine->ref.ref();
|
d->fontEngine->ref.ref();
|
||||||
|
|
||||||
oldFontEngine->ref.deref();
|
oldFontEngine->ref.deref();
|
||||||
if (oldFontEngine->cache_count == 0 && oldFontEngine->ref == 0)
|
if (oldFontEngine->cache_count == 0 && oldFontEngine->ref.load() == 0)
|
||||||
delete oldFontEngine;
|
delete oldFontEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ void QRawFontPrivate::cleanUp()
|
|||||||
platformCleanUp();
|
platformCleanUp();
|
||||||
if (fontEngine != 0) {
|
if (fontEngine != 0) {
|
||||||
fontEngine->ref.deref();
|
fontEngine->ref.deref();
|
||||||
if (fontEngine->cache_count == 0 && fontEngine->ref == 0)
|
if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0)
|
||||||
delete fontEngine;
|
delete fontEngine;
|
||||||
fontEngine = 0;
|
fontEngine = 0;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
~QRawFontPrivate()
|
~QRawFontPrivate()
|
||||||
{
|
{
|
||||||
Q_ASSERT(ref == 0);
|
Q_ASSERT(ref.load() == 0);
|
||||||
cleanUp();
|
cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ QStaticText::QStaticText(const QStaticText &other)
|
|||||||
*/
|
*/
|
||||||
QStaticText::~QStaticText()
|
QStaticText::~QStaticText()
|
||||||
{
|
{
|
||||||
Q_ASSERT(!data || data->ref >= 1);
|
Q_ASSERT(!data || data->ref.load() >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -185,7 +185,7 @@ QStaticText::~QStaticText()
|
|||||||
*/
|
*/
|
||||||
void QStaticText::detach()
|
void QStaticText::detach()
|
||||||
{
|
{
|
||||||
if (data->ref != 1)
|
if (data->ref.load() != 1)
|
||||||
data.detach();
|
data.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,7 +1219,7 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine)
|
|||||||
{
|
{
|
||||||
if (fontEngine) {
|
if (fontEngine) {
|
||||||
fontEngine->ref.deref();
|
fontEngine->ref.deref();
|
||||||
if (fontEngine->cache_count == 0 && fontEngine->ref == 0)
|
if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0)
|
||||||
delete fontEngine;
|
delete fontEngine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,19 +96,19 @@ bool QBearerEngine::configurationsInUse() const
|
|||||||
|
|
||||||
for (it = accessPointConfigurations.constBegin(),
|
for (it = accessPointConfigurations.constBegin(),
|
||||||
end = accessPointConfigurations.constEnd(); it != end; ++it) {
|
end = accessPointConfigurations.constEnd(); it != end; ++it) {
|
||||||
if (it.value()->ref > 1)
|
if (it.value()->ref.load() > 1)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (it = snapConfigurations.constBegin(),
|
for (it = snapConfigurations.constBegin(),
|
||||||
end = snapConfigurations.constEnd(); it != end; ++it) {
|
end = snapConfigurations.constEnd(); it != end; ++it) {
|
||||||
if (it.value()->ref > 1)
|
if (it.value()->ref.load() > 1)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (it = userChoiceConfigurations.constBegin(),
|
for (it = userChoiceConfigurations.constBegin(),
|
||||||
end = userChoiceConfigurations.constEnd(); it != end; ++it) {
|
end = userChoiceConfigurations.constEnd(); it != end; ++it) {
|
||||||
if (it.value()->ref > 1)
|
if (it.value()->ref.load() > 1)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ public:
|
|||||||
|
|
||||||
template<> void QSharedDataPointer<QNetworkProxyPrivate>::detach()
|
template<> void QSharedDataPointer<QNetworkProxyPrivate>::detach()
|
||||||
{
|
{
|
||||||
if (d && d->ref == 1)
|
if (d && d->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
QNetworkProxyPrivate *x = (d ? new QNetworkProxyPrivate(*d)
|
QNetworkProxyPrivate *x = (d ? new QNetworkProxyPrivate(*d)
|
||||||
: new QNetworkProxyPrivate);
|
: new QNetworkProxyPrivate);
|
||||||
@ -727,7 +727,7 @@ public:
|
|||||||
|
|
||||||
template<> void QSharedDataPointer<QNetworkProxyQueryPrivate>::detach()
|
template<> void QSharedDataPointer<QNetworkProxyQueryPrivate>::detach()
|
||||||
{
|
{
|
||||||
if (d && d->ref == 1)
|
if (d && d->ref.load() == 1)
|
||||||
return;
|
return;
|
||||||
QNetworkProxyQueryPrivate *x = (d ? new QNetworkProxyQueryPrivate(*d)
|
QNetworkProxyQueryPrivate *x = (d ? new QNetworkProxyQueryPrivate(*d)
|
||||||
: new QNetworkProxyQueryPrivate);
|
: new QNetworkProxyQueryPrivate);
|
||||||
|
@ -333,7 +333,7 @@ QGLFormat::QGLFormat(QGL::FormatOptions options, int plane)
|
|||||||
*/
|
*/
|
||||||
void QGLFormat::detach()
|
void QGLFormat::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QGLFormatPrivate *newd = new QGLFormatPrivate(d);
|
QGLFormatPrivate *newd = new QGLFormatPrivate(d);
|
||||||
if (!d->ref.deref())
|
if (!d->ref.deref())
|
||||||
delete d;
|
delete d;
|
||||||
@ -4907,7 +4907,7 @@ void QGLContextGroup::addShare(const QGLContext *context, const QGLContext *shar
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Make sure 'context' is not already shared with another group of contexts.
|
// Make sure 'context' is not already shared with another group of contexts.
|
||||||
Q_ASSERT(context->d_ptr->group->m_refs == 1);
|
Q_ASSERT(context->d_ptr->group->m_refs.load() == 1);
|
||||||
|
|
||||||
// Free 'context' group resources and make it use the same resources as 'share'.
|
// Free 'context' group resources and make it use the same resources as 'share'.
|
||||||
QGLContextGroup *group = share->d_ptr->group;
|
QGLContextGroup *group = share->d_ptr->group;
|
||||||
|
@ -106,7 +106,7 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
|
|||||||
*/
|
*/
|
||||||
void QGLFramebufferObjectFormat::detach()
|
void QGLFramebufferObjectFormat::detach()
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QGLFramebufferObjectFormatPrivate *newd
|
QGLFramebufferObjectFormatPrivate *newd
|
||||||
= new QGLFramebufferObjectFormatPrivate(d);
|
= new QGLFramebufferObjectFormatPrivate(d);
|
||||||
if (!d->ref.deref())
|
if (!d->ref.deref())
|
||||||
|
@ -983,8 +983,9 @@ void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool block
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->threadData->canWait || (d->serialNumber != d->lastSerial)) {
|
int serial = d->serialNumber.load();
|
||||||
d->lastSerial = d->serialNumber;
|
if (!d->threadData->canWait || (serial != d->lastSerial)) {
|
||||||
|
d->lastSerial = serial;
|
||||||
QWindowSystemInterface::sendWindowSystemEvents(d->q_func(), QEventLoop::AllEvents);
|
QWindowSystemInterface::sendWindowSystemEvents(d->q_func(), QEventLoop::AllEvents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ QSqlDatabasePrivate *QSqlDatabasePrivate::shared_null()
|
|||||||
|
|
||||||
void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn)
|
void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn)
|
||||||
{
|
{
|
||||||
if (db.d->ref != 1 && doWarn) {
|
if (db.d->ref.load() != 1 && doWarn) {
|
||||||
qWarning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, "
|
qWarning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, "
|
||||||
"all queries will cease to work.", name.toLocal8Bit().constData());
|
"all queries will cease to work.", name.toLocal8Bit().constData());
|
||||||
db.d->disable();
|
db.d->disable();
|
||||||
|
@ -348,7 +348,7 @@ bool QSqlQuery::isNull(int field) const
|
|||||||
|
|
||||||
bool QSqlQuery::exec(const QString& query)
|
bool QSqlQuery::exec(const QString& query)
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
bool fo = isForwardOnly();
|
bool fo = isForwardOnly();
|
||||||
*this = QSqlQuery(driver()->createResult());
|
*this = QSqlQuery(driver()->createResult());
|
||||||
d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());
|
d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());
|
||||||
@ -895,7 +895,7 @@ void QSqlQuery::clear()
|
|||||||
*/
|
*/
|
||||||
bool QSqlQuery::prepare(const QString& query)
|
bool QSqlQuery::prepare(const QString& query)
|
||||||
{
|
{
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
bool fo = isForwardOnly();
|
bool fo = isForwardOnly();
|
||||||
*this = QSqlQuery(driver()->createResult());
|
*this = QSqlQuery(driver()->createResult());
|
||||||
setForwardOnly(fo);
|
setForwardOnly(fo);
|
||||||
|
@ -767,7 +767,7 @@ bool QIcon::isNull() const
|
|||||||
*/
|
*/
|
||||||
bool QIcon::isDetached() const
|
bool QIcon::isDetached() const
|
||||||
{
|
{
|
||||||
return !d || d->ref == 1;
|
return !d || d->ref.load() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
@ -775,7 +775,7 @@ bool QIcon::isDetached() const
|
|||||||
void QIcon::detach()
|
void QIcon::detach()
|
||||||
{
|
{
|
||||||
if (d) {
|
if (d) {
|
||||||
if (d->ref != 1) {
|
if (d->ref.load() != 1) {
|
||||||
QIconPrivate *x = new QIconPrivate;
|
QIconPrivate *x = new QIconPrivate;
|
||||||
if (d->engine_version > 1) {
|
if (d->engine_version > 1) {
|
||||||
QIconEngineV2 *engine = static_cast<QIconEngineV2 *>(d->engine);
|
QIconEngineV2 *engine = static_cast<QIconEngineV2 *>(d->engine);
|
||||||
|
@ -4509,7 +4509,7 @@ void QDomElementPrivate::setAttributeNS(const QString& nsURI, const QString& qNa
|
|||||||
void QDomElementPrivate::removeAttribute(const QString& aname)
|
void QDomElementPrivate::removeAttribute(const QString& aname)
|
||||||
{
|
{
|
||||||
QDomNodePrivate* p = m_attr->removeNamedItem(aname);
|
QDomNodePrivate* p = m_attr->removeNamedItem(aname);
|
||||||
if (p && p->ref == 0)
|
if (p && p->ref.load() == 0)
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user