diff options
author | Harald Fernengel <harald@trolltech.com> | 2009-08-21 09:02:17 (GMT) |
---|---|---|
committer | Harald Fernengel <harald@trolltech.com> | 2009-08-21 09:02:17 (GMT) |
commit | 38e0c07a78fb585e23c4ff8947be737a28b2257c (patch) | |
tree | d6b1bd21d1971c6cde4dfc95c19b8abc4ad57296 | |
parent | a44894a39113e0eb9d4f7c912eee4671b3f391c1 (diff) | |
download | Qt-38e0c07a78fb585e23c4ff8947be737a28b2257c.zip Qt-38e0c07a78fb585e23c4ff8947be737a28b2257c.tar.gz Qt-38e0c07a78fb585e23c4ff8947be737a28b2257c.tar.bz2 |
compile again after merge
-rw-r--r-- | src/script/api/qscriptclass.cpp | 2 | ||||
-rw-r--r-- | src/script/api/qscriptcontext.h | 2 | ||||
-rw-r--r-- | src/script/api/qscriptengine.cpp | 18 | ||||
-rw-r--r-- | src/script/api/qscriptstring.cpp | 33 | ||||
-rw-r--r-- | src/script/api/qscriptstring.h | 4 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 37 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.h | 4 | ||||
-rw-r--r-- | src/script/api/qscriptvalue_p.h | 2 |
8 files changed, 14 insertions, 88 deletions
diff --git a/src/script/api/qscriptclass.cpp b/src/script/api/qscriptclass.cpp index cff6ce5..f96a5bc 100644 --- a/src/script/api/qscriptclass.cpp +++ b/src/script/api/qscriptclass.cpp @@ -174,8 +174,6 @@ QScriptClass::QScriptClass(QScriptEngine *engine, QScriptClassPrivate &dd) */ QScriptClass::~QScriptClass() { - delete d_ptr; - d_ptr = 0; } /*! diff --git a/src/script/api/qscriptcontext.h b/src/script/api/qscriptcontext.h index 593f615..2eb0c85 100644 --- a/src/script/api/qscriptcontext.h +++ b/src/script/api/qscriptcontext.h @@ -110,7 +110,7 @@ public: private: QScriptContext(); - QScopedPointer<QScriptContextPrivate> d_ptr; + QScriptContextPrivate *d_ptr; Q_DECLARE_PRIVATE(QScriptContext) Q_DISABLE_COPY(QScriptContext) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 6fde08f..131fe28 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -634,7 +634,7 @@ JSC::JSValue JSC_HOST_CALL functionPrint(JSC::ExecState* exec, JSC::JSObject*, J } if (exec->hadException()) return exec->exception(); - qDebug(qPrintable(result)); + qDebug("%s", qPrintable(result)); return JSC::jsUndefined(); } @@ -3744,8 +3744,6 @@ QScriptValue QScriptEngine::objectById(qint64 id) const QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(const QScriptSyntaxCheckResult &other) : d_ptr(other.d_ptr) { - if (d_ptr) - d_ptr->ref.ref(); } /*! @@ -3754,8 +3752,6 @@ QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(const QScriptSyntaxCheckResul QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate *d) : d_ptr(d) { - if (d_ptr) - d_ptr->ref.ref(); } /*! @@ -3771,10 +3767,6 @@ QScriptSyntaxCheckResult::QScriptSyntaxCheckResult() */ QScriptSyntaxCheckResult::~QScriptSyntaxCheckResult() { - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } } /*! @@ -3836,15 +3828,7 @@ QString QScriptSyntaxCheckResult::errorMessage() const */ QScriptSyntaxCheckResult &QScriptSyntaxCheckResult::operator=(const QScriptSyntaxCheckResult &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); return *this; } diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index 41593d2..b9c26f8 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -46,23 +46,6 @@ QT_BEGIN_NAMESPACE -/*! \internal */ -struct QScriptStringPrivatePointerDeleter -{ - static inline void cleanup(QScriptStringPrivate *d) - { - if (!d || d->ref.deref()) - return; - - if (d->nameId) { - d->engine->uninternString(d); - } else { - // the engine has already been deleted - delete d; - } - } -}; - /*! \since 4.4 \class QScriptString @@ -107,10 +90,9 @@ QScriptStringPrivate::~QScriptStringPrivate() void QScriptStringPrivate::init(QScriptString &q, QScriptEngine *engine, const JSC::Identifier &value) { Q_ASSERT(!q.isValid()); - q.d_ptr.data_ptr() = new QScriptStringPrivate(); + q.d_ptr = new QScriptStringPrivate(); q.d_ptr->identifier = value; q.d_ptr->engine = engine; - q.d_ptr->ref.ref(); } /*! @@ -125,10 +107,8 @@ QScriptString::QScriptString() Constructs a new QScriptString that is a copy of \a other. */ QScriptString::QScriptString(const QScriptString &other) - : d_ptr(other.d_ptr.data()) + : d_ptr(other.d_ptr) { - if (d_ptr) - d_ptr->ref.ref(); } /*! @@ -143,14 +123,7 @@ QScriptString::~QScriptString() */ QScriptString &QScriptString::operator=(const QScriptString &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - } - d_ptr.reset(other.d_ptr); - if (d_ptr) - d_ptr->ref.ref(); + d_ptr = other.d_ptr; return *this; } diff --git a/src/script/api/qscriptstring.h b/src/script/api/qscriptstring.h index c141e76..b216703 100644 --- a/src/script/api/qscriptstring.h +++ b/src/script/api/qscriptstring.h @@ -44,7 +44,7 @@ #include <QtCore/qstring.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/qsharedpointer.h> QT_BEGIN_HEADER @@ -74,7 +74,7 @@ public: operator QString() const; private: - QCustomScopedPointer<QScriptStringPrivate, QScriptStringPrivatePointerDeleter> d_ptr; + QExplicitlySharedDataPointer<QScriptStringPrivate> d_ptr; friend class QScriptValue; Q_DECLARE_PRIVATE(QScriptString) }; diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 7b28e37..c344aed 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -282,6 +282,8 @@ QScriptValuePrivate::QScriptValuePrivate() : engine(0), prev(0), next(0) QScriptValuePrivate::~QScriptValuePrivate() { + if (engine) + engine->unregisterScriptValue(this); } void QScriptValuePrivate::initFrom(JSC::JSValue value) @@ -416,11 +418,6 @@ QScriptValue::QScriptValue() */ QScriptValue::~QScriptValue() { - if (d_ptr && !d_ptr->ref.deref()) { - if (d_ptr->engine) - d_ptr->engine->unregisterScriptValue(d_ptr); - delete d_ptr; - } } /*! @@ -433,8 +430,6 @@ QScriptValue::~QScriptValue() QScriptValue::QScriptValue(const QScriptValue &other) : d_ptr(other.d_ptr) { - if (d_ptr) - d_ptr->ref.ref(); } /*! @@ -455,7 +450,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, QScriptValue::SpecialValue val d_ptr->initFrom(JSC::jsUndefined()); break; } - d_ptr->ref.ref(); } /*! @@ -471,7 +465,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, bool val) { d_ptr->engine = QScriptEnginePrivate::get(engine); d_ptr->initFrom(JSC::jsBoolean(val)); - d_ptr->ref.ref(); } /*! @@ -495,7 +488,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, int val) else d_ptr->initFrom(val); } - d_ptr->ref.ref(); } /*! @@ -519,7 +511,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, uint val) else d_ptr->initFrom(val); } - d_ptr->ref.ref(); } /*! @@ -543,7 +534,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val) else d_ptr->initFrom(val); } - d_ptr->ref.ref(); } /*! @@ -563,7 +553,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const QString &val) } else { d_ptr->initFrom(val); } - d_ptr->ref.ref(); } /*! @@ -585,7 +574,6 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const char *val) } else { d_ptr->initFrom(QString::fromAscii(val)); } - d_ptr->ref.ref(); } #endif @@ -606,7 +594,6 @@ QScriptValue::QScriptValue(SpecialValue value) d_ptr->initFrom(JSC::jsUndefined()); break; } - d_ptr->ref.ref(); } /*! @@ -619,7 +606,6 @@ QScriptValue::QScriptValue(bool value) { d_ptr->engine = 0; d_ptr->initFrom(JSC::jsBoolean(value)); - d_ptr->ref.ref(); } /*! @@ -636,7 +622,6 @@ QScriptValue::QScriptValue(int value) d_ptr->initFrom(immediate); else d_ptr->initFrom(value); - d_ptr->ref.ref(); } /*! @@ -653,7 +638,6 @@ QScriptValue::QScriptValue(uint value) d_ptr->initFrom(immediate); else d_ptr->initFrom(value); - d_ptr->ref.ref(); } /*! @@ -670,7 +654,6 @@ QScriptValue::QScriptValue(qsreal value) d_ptr->initFrom(immediate); else d_ptr->initFrom(value); - d_ptr->ref.ref(); } /*! @@ -683,7 +666,6 @@ QScriptValue::QScriptValue(const QString &value) { d_ptr->engine = 0; d_ptr->initFrom(value); - d_ptr->ref.ref(); } /*! @@ -696,7 +678,6 @@ QScriptValue::QScriptValue(const QLatin1String &value) { d_ptr->engine = 0; d_ptr->initFrom(value); - d_ptr->ref.ref(); } /*! @@ -711,7 +692,6 @@ QScriptValue::QScriptValue(const char *value) { d_ptr->engine = 0; d_ptr->initFrom(QString::fromAscii(value)); - d_ptr->ref.ref(); } #endif @@ -724,16 +704,7 @@ QScriptValue::QScriptValue(const char *value) */ QScriptValue &QScriptValue::operator=(const QScriptValue &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) { - if (d_ptr->engine) - d_ptr->engine->unregisterScriptValue(d_ptr); - delete d_ptr; - } d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); return *this; } @@ -1125,7 +1096,7 @@ bool QScriptValue::equals(const QScriptValue &other) const { Q_D(const QScriptValue); if (!d || !other.d_ptr) - return (d == other.d_ptr); + return (d_ptr == other.d_ptr); if (other.engine() && engine() && (other.engine() != engine())) { qWarning("QScriptValue::equals: " "cannot compare to a value created in " @@ -1179,7 +1150,7 @@ bool QScriptValue::strictlyEquals(const QScriptValue &other) const { Q_D(const QScriptValue); if (!d || !other.d_ptr) - return (d == other.d_ptr); + return (d_ptr == other.d_ptr); if (other.engine() && engine() && (other.engine() != engine())) { qWarning("QScriptValue::strictlyEquals: " "cannot compare to a value created in " diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h index 0881ac3..67b9514 100644 --- a/src/script/api/qscriptvalue.h +++ b/src/script/api/qscriptvalue.h @@ -45,7 +45,7 @@ #include <QtCore/qstring.h> #include <QtCore/qlist.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/qsharedpointer.h> QT_BEGIN_HEADER @@ -221,7 +221,7 @@ private: inline QScriptValue(QScriptEngine *, void *); private: - QCustomScopedPointer<QScriptValuePrivate, QScriptValuePrivatePointerDeleter> d_ptr; + QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptValue) }; diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index e05259e..bab59fe 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -88,7 +88,7 @@ public: static QScriptValuePrivate *get(const QScriptValue &q) { - return q.d_ptr; + return q.d_ptr.data(); } static QScriptValue toPublic(QScriptValuePrivate *d) |