From ec30175915542e3b5c9cff2d807c62ad93d39a54 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 24 Aug 2009 18:02:14 +0200 Subject: add an internal QScriptValue ctor to initialize from d-pointer Avoid having to create a dummy QScriptValue (which will have its d_ptr set to 0). --- src/script/api/qscriptvalue.cpp | 8 ++++++++ src/script/api/qscriptvalue.h | 2 ++ src/script/api/qscriptvalue_p.h | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/script') diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index b0e09ded40..494eac83af 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -370,6 +370,14 @@ void QScriptValuePrivate::operator delete(void *ptr) qFree(d); } +/*! + \internal +*/ +QScriptValue::QScriptValue(QScriptValuePrivate *d) + : d_ptr(d) +{ +} + /*! Constructs an invalid QScriptValue. */ diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h index 67b9514698..afa247ae6a 100644 --- a/src/script/api/qscriptvalue.h +++ b/src/script/api/qscriptvalue.h @@ -220,6 +220,8 @@ private: // force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called inline QScriptValue(QScriptEngine *, void *); + QScriptValue(QScriptValuePrivate*); + private: QExplicitlySharedDataPointer d_ptr; diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 06bc92744d..09338658c1 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -96,9 +96,7 @@ public: static inline QScriptValue toPublic(QScriptValuePrivate *d) { - QScriptValue tmp; - tmp.d_ptr = d; - return tmp; + return QScriptValue(d); } QScriptValue property(const JSC::Identifier &id, int resolveMode) const; -- cgit v1.2.1