{
if (pendingAssignment) {
Q_D(QFutureWatcherBase);
- d->pendingResultsReady = 0;
+ d->pendingResultsReady.store(0);
qDeleteAll(d->pendingCallOutEvents);
d->pendingCallOutEvents.clear();
d->finished = false;
emit q->finished();
break;
case QFutureCallOutEvent::Canceled:
- pendingResultsReady = 0;
+ pendingResultsReady.store(0);
emit q->canceled();
break;
case QFutureCallOutEvent::Paused:
return result;
}
-
-QUrlPrivate::QUrlPrivate()
+QUrlPrivate::QUrlPrivate() : ref(1), port(-1), parsingMode(QUrl::TolerantMode),
+ hasQuery(false), hasFragment(false), isValid(false), isHostValid(true),
+ valueDelimiter('='), pairDelimiter('&'),
+ stateFlags(0)
{
- ref = 1;
- port = -1;
- isValid = false;
- isHostValid = true;
- parsingMode = QUrl::TolerantMode;
- valueDelimiter = '=';
- pairDelimiter = '&';
- stateFlags = 0;
- hasFragment = false;
- hasQuery = false;
}
QUrlPrivate::QUrlPrivate(const QUrlPrivate ©)
- : scheme(copy.scheme),
+ : ref(1), scheme(copy.scheme),
userName(copy.userName),
password(copy.password),
host(copy.host),
pairDelimiter(copy.pairDelimiter),
stateFlags(copy.stateFlags),
encodedNormalized(copy.encodedNormalized)
-{ ref = 1; }
+{
+}
QString QUrlPrivate::canonicalHost() const
{
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
return (!data->canWait
- || (source->serialNumber != source->lastSerialNumber));
+ || (source->serialNumber.load() != source->lastSerialNumber));
}
static gboolean postEventSourceCheck(GSource *source)
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
{
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
- source->lastSerialNumber = source->serialNumber;
+ source->lastSerialNumber = source->serialNumber.load();
QCoreApplication::sendPostedEvents();
source->d->runTimersOnceWithNormalPriority();
return true; // i dunno, george...
// setup post event source
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
- postEventSource->serialNumber = 1;
+ postEventSource->serialNumber.store(1);
postEventSource->d = this;
g_source_set_can_recurse(&postEventSource->source, true);
g_source_attach(&postEventSource->source, mainContext);
c->method_relative = method_index;
c->method_offset = method_offset;
c->connectionType = type;
- c->argumentTypes = types;
+ c->argumentTypes.store(types);
c->nextConnectionList = 0;
c->callFunction = callFunction;
if (!d->marshaller()->ok)
return false;
- if (d->message && d->ref != 1) {
+ if (d->message && d->ref.load() != 1) {
QDBusMarshaller *dd = new QDBusMarshaller(d->capabilities);
dd->message = q_dbus_message_copy(d->message);
q_dbus_message_iter_init_append(dd->message, &dd->iterator);
if (!checkRead(d))
return false; // don't bother
- if (d->ref == 1)
+ if (d->ref.load() == 1)
return true; // no need to detach
QDBusDemarshaller *dd = new QDBusDemarshaller(d->capabilities);
(*(*list)[i])(amsg);
}
- if (!ref)
+ if (!ref.load())
return false;
switch (amsg.type()) {
checkThread();
QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this);
- pcall->ref = 0;
+ pcall->ref.store(0);
QDBusError error;
DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error);
*/
bool QDBusUnixFileDescriptor::isValid() const
{
- return d ? d->fd != -1 : false;
+ return d ? d->fd.load() != -1 : false;
}
/*!
*/
int QDBusUnixFileDescriptor::fileDescriptor() const
{
- return d ? d->fd.operator int() : -1;
+ return d ? d->fd.load() : -1;
}
// actual implementation
else
d = new QDBusUnixFileDescriptorPrivate;
- if (d->fd != -1)
- qt_safe_close(d->fd);
+ const int fdl = d->fd.load();
+ if (fdl != -1)
+ qt_safe_close(fdl);
if (fileDescriptor != -1)
- d->fd = fileDescriptor;
+ d->fd.store(fileDescriptor);
}
/*!
QDBusUnixFileDescriptorPrivate::~QDBusUnixFileDescriptorPrivate()
{
- if (fd != -1)
- qt_safe_close(fd);
+ const int fdl = fd.load();
+ if (fdl != -1)
+ qt_safe_close(fdl);
}
#else
*****************************************************************************/
QCursorData::QCursorData(Qt::CursorShape s)
- : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s)
+ : ref(1), cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s)
{
- ref = 1;
}
QCursorData::~QCursorData()
inline QTouchEventTouchPointPrivate *detach()
{
QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this);
- d->ref = 1;
+ d->ref.store(1);
if (!this->ref.deref())
delete this;
return d;
class Q_AUTOTEST_EXPORT QKeySequencePrivate
{
public:
- inline QKeySequencePrivate()
+ inline QKeySequencePrivate() : ref(1)
{
- ref = 1;
key[0] = key[1] = key[2] = key[3] = 0;
}
- inline QKeySequencePrivate(const QKeySequencePrivate ©)
+ inline QKeySequencePrivate(const QKeySequencePrivate ©) : ref(1)
{
- ref = 1;
key[0] = copy.key[0];
key[1] = copy.key[1];
key[2] = copy.key[2];
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
#endif
+
+ QPainterPathPrivate() : ref(1) {}
+
private:
QAtomicInt ref;
QVector<QPainterPath::Element> elements;
dirtyControlBounds(false),
pathConverter(0)
{
- ref = 1;
require_moveTo = false;
convex = false;
}
QPainterPathData(const QPainterPathData &other) :
- QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule),
+ cStart(other.cStart), fillRule(other.fillRule),
bounds(other.bounds),
controlBounds(other.controlBounds),
dirtyBounds(other.dirtyBounds),
convex(other.convex),
pathConverter(0)
{
- ref = 1;
require_moveTo = false;
elements = other.elements;
}
QPenData *x = new QPenData(*static_cast<QPenData *>(d));
if (!d->ref.deref())
delete d;
- x->ref = 1;
+ x->ref.store(1);
d = x;
}
newFreetype->hbFace = qHBNewFace(face, hb_getSFntTable);
Q_CHECK_PTR(newFreetype->hbFace);
- newFreetype->ref = 1;
+ newFreetype->ref.store(1);
newFreetype->xsize = 0;
newFreetype->ysize = 0;
newFreetype->matrix.xx = 0x10000;
OpenGLUserData
};
- QStaticTextUserData(Type t) : type(t) { ref = 0; }
+ QStaticTextUserData(Type t) : ref(0), type(t) {}
virtual ~QStaticTextUserData() {}
QAtomicInt ref;
{
if (!d) {
d = new QAuthenticatorPrivate;
- d->ref = 1;
+ d->ref.store(1);
return;
}
// create a deep copy of our configuration
QSslConfigurationPrivate *copy = new QSslConfigurationPrivate(d->configuration);
- copy->ref = 0; // the QSslConfiguration constructor refs up
+ copy->ref.store(0); // the QSslConfiguration constructor refs up
copy->sessionCipher = d->sessionCipher();
return QSslConfiguration(copy);
return;
}
- ptr->ref = 1;
+ ptr->ref.store(1);
ptr->peerCertificate = global->peerCertificate;
ptr->peerCertificateChain = global->peerCertificateChain;
ptr->localCertificate = global->localCertificate;
{
public:
QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = 0):
+ ref(1),
q(d),
driver(dr),
port(-1)
{
- ref = 1;
if(driver)
precisionPolicy = driver->numericalPrecisionPolicy();
else
static void cleanConnections();
};
-QSqlDatabasePrivate::QSqlDatabasePrivate(const QSqlDatabasePrivate &other)
+QSqlDatabasePrivate::QSqlDatabasePrivate(const QSqlDatabasePrivate &other) : ref(1)
{
- ref = 1;
q = other.q;
dbname = other.dbname;
uname = other.uname;
QAtomicInt ref;
};
-QSqlRecordPrivate::QSqlRecordPrivate()
+QSqlRecordPrivate::QSqlRecordPrivate() : ref(1)
{
- ref = 1;
}
-QSqlRecordPrivate::QSqlRecordPrivate(const QSqlRecordPrivate &other): fields(other.fields)
+QSqlRecordPrivate::QSqlRecordPrivate(const QSqlRecordPrivate &other): fields(other.fields), ref(1)
{
- ref = 1;
}
/*! \internal
*
**************************************************************/
-QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl)
+QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl) : ref(1)
{
- ref = 1;
node_impl = n_impl;
if (node_impl)
node_impl->ref.ref();
timestamp = 0;
}
-QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &name)
+QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &name) :
+ ref(1)
{
- ref = 1;
node_impl = n_impl;
if (node_impl)
node_impl->ref.ref();
timestamp = 0;
}
-QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &_nsURI, const QString &localName)
+QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &_nsURI, const QString &localName) :
+ ref(1)
{
- ref = 1;
node_impl = n_impl;
if (node_impl)
node_impl->ref.ref();
hasParent = false;
}
-QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par)
+QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par) : ref(1)
{
- ref = 1;
if (par)
setParent(par);
else
columnNumber = -1;
}
-QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep)
+QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep) : ref(1)
{
- ref = 1;
setOwnerDocument(n->ownerDocument());
prev = 0;
next = 0;
*
**************************************************************/
-QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n)
+QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n) : ref(1)
{
- ref = 1;
readonly = false;
parent = n;
appendToParent = false;