diff options
Diffstat (limited to 'src/scripttools')
35 files changed, 58 insertions, 110 deletions
diff --git a/src/scripttools/debugging/qscriptbreakpointdata.cpp b/src/scripttools/debugging/qscriptbreakpointdata.cpp index 46aa58a..94a6a80 100644 --- a/src/scripttools/debugging/qscriptbreakpointdata.cpp +++ b/src/scripttools/debugging/qscriptbreakpointdata.cpp @@ -136,7 +136,6 @@ QScriptBreakpointData::QScriptBreakpointData(const QScriptBreakpointData &other) */ QScriptBreakpointData::~QScriptBreakpointData() { - delete d_ptr; } /*! @@ -355,7 +354,7 @@ bool QScriptBreakpointData::operator!=(const QScriptBreakpointData &other) const */ QDataStream &operator<<(QDataStream &out, const QScriptBreakpointData &data) { - const QScriptBreakpointDataPrivate *d = data.d_ptr; + const QScriptBreakpointDataPrivate *d = data.d_ptr.data(); out << d->scriptId; out << d->fileName; out << d->lineNumber; @@ -377,7 +376,7 @@ QDataStream &operator<<(QDataStream &out, const QScriptBreakpointData &data) */ QDataStream &operator>>(QDataStream &in, QScriptBreakpointData &data) { - QScriptBreakpointDataPrivate *d = data.d_ptr; + QScriptBreakpointDataPrivate *d = data.d_ptr.data(); in >> d->scriptId; in >> d->fileName; in >> d->lineNumber; diff --git a/src/scripttools/debugging/qscriptbreakpointdata_p.h b/src/scripttools/debugging/qscriptbreakpointdata_p.h index 146789a..e9d6386 100644 --- a/src/scripttools/debugging/qscriptbreakpointdata_p.h +++ b/src/scripttools/debugging/qscriptbreakpointdata_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qmap.h> QT_BEGIN_NAMESPACE @@ -114,7 +114,7 @@ public: bool operator!=(const QScriptBreakpointData &other) const; private: - QScriptBreakpointDataPrivate *d_ptr; + QScopedPointer<QScriptBreakpointDataPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptBreakpointData) }; diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp index 3a5b400..d6f63ee 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp +++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp @@ -385,7 +385,6 @@ QScriptDebuggerBackend::QScriptDebuggerBackend() QScriptDebuggerBackend::~QScriptDebuggerBackend() { detach(); - delete d_ptr; } /*! diff --git a/src/scripttools/debugging/qscriptdebuggerbackend_p.h b/src/scripttools/debugging/qscriptdebuggerbackend_p.h index 5f18e70..120d96b 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend_p.h +++ b/src/scripttools/debugging/qscriptdebuggerbackend_p.h @@ -144,7 +144,7 @@ protected: protected: QScriptDebuggerBackend(QScriptDebuggerBackendPrivate &dd); - QScriptDebuggerBackendPrivate *d_ptr; + QScopedPointer<QScriptDebuggerBackendPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptDebuggerBackend) diff --git a/src/scripttools/debugging/qscriptdebuggercommand.cpp b/src/scripttools/debugging/qscriptdebuggercommand.cpp index 1691fba..638d58a 100644 --- a/src/scripttools/debugging/qscriptdebuggercommand.cpp +++ b/src/scripttools/debugging/qscriptdebuggercommand.cpp @@ -119,7 +119,6 @@ QScriptDebuggerCommand::QScriptDebuggerCommand(const QScriptDebuggerCommand &oth */ QScriptDebuggerCommand::~QScriptDebuggerCommand() { - delete d_ptr; } /*! @@ -666,7 +665,7 @@ QScriptDebuggerCommand QScriptDebuggerCommand::clearExceptionsCommand() */ QDataStream &operator<<(QDataStream &out, const QScriptDebuggerCommand &command) { - const QScriptDebuggerCommandPrivate *d = command.d_ptr; + const QScriptDebuggerCommandPrivate *d = command.d_ptr.data(); out << (quint32)d->type; out << (qint32)d->attributes.size(); QHash<QScriptDebuggerCommand::Attribute, QVariant>::const_iterator it; @@ -686,7 +685,7 @@ QDataStream &operator<<(QDataStream &out, const QScriptDebuggerCommand &command) */ QDataStream &operator>>(QDataStream &in, QScriptDebuggerCommand &command) { - QScriptDebuggerCommandPrivate *d = command.d_ptr; + QScriptDebuggerCommandPrivate *d = command.d_ptr.data(); quint32 type; in >> type; diff --git a/src/scripttools/debugging/qscriptdebuggercommand_p.h b/src/scripttools/debugging/qscriptdebuggercommand_p.h index 4d4ef22..b252853 100644 --- a/src/scripttools/debugging/qscriptdebuggercommand_p.h +++ b/src/scripttools/debugging/qscriptdebuggercommand_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qhash.h> #include <QtCore/qvariant.h> @@ -255,7 +255,7 @@ public: static QScriptDebuggerCommand clearExceptionsCommand(); private: - QScriptDebuggerCommandPrivate *d_ptr; + QScopedPointer<QScriptDebuggerCommandPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerCommand) }; diff --git a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp index d8b2e87..7dcb0ee 100644 --- a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp +++ b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp @@ -98,7 +98,6 @@ QScriptDebuggerCommandExecutor::QScriptDebuggerCommandExecutor() QScriptDebuggerCommandExecutor::~QScriptDebuggerCommandExecutor() { - delete d_ptr; } static bool isPrefixOf(const QString &prefix, const QString &what) diff --git a/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h b/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h index e91dfe7..8e6813e 100644 --- a/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h +++ b/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h @@ -54,6 +54,7 @@ // #include <QtCore/qobjectdefs.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE @@ -74,7 +75,7 @@ public: protected: QScriptDebuggerCommandExecutor(QScriptDebuggerCommandExecutorPrivate &dd); - QScriptDebuggerCommandExecutorPrivate *d_ptr; + QScopedPointer<QScriptDebuggerCommandExecutorPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptDebuggerCommandExecutor) diff --git a/src/scripttools/debugging/qscriptdebuggerconsole.cpp b/src/scripttools/debugging/qscriptdebuggerconsole.cpp index 856f8b3..06646f1 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsole.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsole.cpp @@ -199,7 +199,6 @@ QScriptDebuggerConsole::QScriptDebuggerConsole() QScriptDebuggerConsole::~QScriptDebuggerConsole() { - delete d_ptr; } void QScriptDebuggerConsole::loadScriptedCommands(const QString &scriptsPath, diff --git a/src/scripttools/debugging/qscriptdebuggerconsole_p.h b/src/scripttools/debugging/qscriptdebuggerconsole_p.h index 2f76db6..b209a65 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsole_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsole_p.h @@ -54,6 +54,7 @@ // #include <QtCore/qobjectdefs.h> +#include <QtCore/qscopedpointer.h> #include "qscriptdebuggerconsolehistorianinterface_p.h" @@ -109,7 +110,7 @@ public: void bumpSessionId(); private: - QScriptDebuggerConsolePrivate *d_ptr; + QScopedPointer<QScriptDebuggerConsolePrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerConsole) Q_DISABLE_COPY(QScriptDebuggerConsole) diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerconsolecommand.cpp index e2d7819..c3d1486 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommand.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommand.cpp @@ -72,7 +72,6 @@ QScriptDebuggerConsoleCommand::QScriptDebuggerConsoleCommand() QScriptDebuggerConsoleCommand::~QScriptDebuggerConsoleCommand() { - delete d_ptr; } QScriptDebuggerConsoleCommand::QScriptDebuggerConsoleCommand(QScriptDebuggerConsoleCommandPrivate &dd) diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h index c3fe94a2..6811799 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qlist.h> QT_BEGIN_NAMESPACE @@ -91,7 +91,7 @@ public: protected: QScriptDebuggerConsoleCommand(QScriptDebuggerConsoleCommandPrivate &dd); - QScriptDebuggerConsoleCommandPrivate *d_ptr; + QScopedPointer<QScriptDebuggerConsoleCommandPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommand) diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata.cpp b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata.cpp index 9942a87..804e275 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata.cpp @@ -90,7 +90,7 @@ QScriptDebuggerConsoleCommandGroupData::QScriptDebuggerConsoleCommandGroupData( QScriptDebuggerConsoleCommandGroupData::QScriptDebuggerConsoleCommandGroupData( const QScriptDebuggerConsoleCommandGroupData &other) - : d_ptr(other.d_ptr) + : d_ptr(other.d_ptr.data()) { if (d_ptr) d_ptr->ref.ref(); @@ -98,22 +98,12 @@ QScriptDebuggerConsoleCommandGroupData::QScriptDebuggerConsoleCommandGroupData( QScriptDebuggerConsoleCommandGroupData::~QScriptDebuggerConsoleCommandGroupData() { - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } } QScriptDebuggerConsoleCommandGroupData &QScriptDebuggerConsoleCommandGroupData::operator=( const QScriptDebuggerConsoleCommandGroupData &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) - delete d_ptr; - d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); + d_ptr.assign(other.d_ptr.data()); return *this; } diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h index e7727f8..81e25e4 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qmap.h> QT_BEGIN_NAMESPACE @@ -82,7 +82,7 @@ public: const QScriptDebuggerConsoleCommandGroupData &other); private: - QScriptDebuggerConsoleCommandGroupDataPrivate *d_ptr; + QScopedSharedPointer<QScriptDebuggerConsoleCommandGroupDataPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommandGroupData) diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp index ca4fcc2..6ed7e0e 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp @@ -105,7 +105,6 @@ QScriptDebuggerConsoleCommandManager::QScriptDebuggerConsoleCommandManager() QScriptDebuggerConsoleCommandManager::~QScriptDebuggerConsoleCommandManager() { - delete d_ptr; } /*! diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h index 2bc47d8..ff68bed 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qmap.h> #include <QtCore/qlist.h> @@ -86,7 +86,7 @@ public: QStringList completions(const QString &prefix) const; private: - QScriptDebuggerConsoleCommandManagerPrivate *d_ptr; + QScopedPointer<QScriptDebuggerConsoleCommandManagerPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommandManager) }; diff --git a/src/scripttools/debugging/qscriptdebuggerevent.cpp b/src/scripttools/debugging/qscriptdebuggerevent.cpp index ce08c9d..5fab17e 100644 --- a/src/scripttools/debugging/qscriptdebuggerevent.cpp +++ b/src/scripttools/debugging/qscriptdebuggerevent.cpp @@ -97,7 +97,6 @@ QScriptDebuggerEvent::QScriptDebuggerEvent(const QScriptDebuggerEvent &other) QScriptDebuggerEvent::~QScriptDebuggerEvent() { - delete d_ptr; } QScriptDebuggerEvent &QScriptDebuggerEvent::operator=(const QScriptDebuggerEvent &other) @@ -276,7 +275,7 @@ bool QScriptDebuggerEvent::operator!=(const QScriptDebuggerEvent &other) const */ QDataStream &operator<<(QDataStream &out, const QScriptDebuggerEvent &event) { - const QScriptDebuggerEventPrivate *d = event.d_ptr; + const QScriptDebuggerEventPrivate *d = event.d_ptr.data(); out << (quint32)d->type; out << (qint32)d->attributes.size(); QHash<QScriptDebuggerEvent::Attribute, QVariant>::const_iterator it; @@ -296,7 +295,7 @@ QDataStream &operator<<(QDataStream &out, const QScriptDebuggerEvent &event) */ QDataStream &operator>>(QDataStream &in, QScriptDebuggerEvent &event) { - QScriptDebuggerEventPrivate *d = event.d_ptr; + QScriptDebuggerEventPrivate *d = event.d_ptr.data(); quint32 type; in >> type; diff --git a/src/scripttools/debugging/qscriptdebuggerevent_p.h b/src/scripttools/debugging/qscriptdebuggerevent_p.h index f854574..72e86cb 100644 --- a/src/scripttools/debugging/qscriptdebuggerevent_p.h +++ b/src/scripttools/debugging/qscriptdebuggerevent_p.h @@ -57,6 +57,7 @@ #include <QtCore/qcoreevent.h> #include <QtCore/qhash.h> #include <QtCore/qvariant.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE @@ -137,7 +138,7 @@ public: bool operator!=(const QScriptDebuggerEvent &other) const; private: - QScriptDebuggerEventPrivate *d_ptr; + QScopedPointer<QScriptDebuggerEventPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerEvent) }; diff --git a/src/scripttools/debugging/qscriptdebuggerfrontend.cpp b/src/scripttools/debugging/qscriptdebuggerfrontend.cpp index e58bfec..24c1cff 100644 --- a/src/scripttools/debugging/qscriptdebuggerfrontend.cpp +++ b/src/scripttools/debugging/qscriptdebuggerfrontend.cpp @@ -143,7 +143,6 @@ QScriptDebuggerFrontend::QScriptDebuggerFrontend() QScriptDebuggerFrontend::~QScriptDebuggerFrontend() { - delete d_ptr; } QScriptDebuggerFrontend::QScriptDebuggerFrontend(QScriptDebuggerFrontendPrivate &dd) diff --git a/src/scripttools/debugging/qscriptdebuggerfrontend_p.h b/src/scripttools/debugging/qscriptdebuggerfrontend_p.h index faad0fd..2b6a319 100644 --- a/src/scripttools/debugging/qscriptdebuggerfrontend_p.h +++ b/src/scripttools/debugging/qscriptdebuggerfrontend_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qstring.h> #include "qscriptdebuggercommandschedulerinterface_p.h" @@ -90,7 +90,7 @@ protected: protected: QScriptDebuggerFrontend(QScriptDebuggerFrontendPrivate &dd); - QScriptDebuggerFrontendPrivate *d_ptr; + QScopedPointer<QScriptDebuggerFrontendPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptDebuggerFrontend) diff --git a/src/scripttools/debugging/qscriptdebuggerjob.cpp b/src/scripttools/debugging/qscriptdebuggerjob.cpp index 0ed1137..8b25f5c 100644 --- a/src/scripttools/debugging/qscriptdebuggerjob.cpp +++ b/src/scripttools/debugging/qscriptdebuggerjob.cpp @@ -85,7 +85,6 @@ QScriptDebuggerJob::QScriptDebuggerJob(QScriptDebuggerJobPrivate &dd) QScriptDebuggerJob::~QScriptDebuggerJob() { - delete d_ptr; } void QScriptDebuggerJob::finish() diff --git a/src/scripttools/debugging/qscriptdebuggerjob_p.h b/src/scripttools/debugging/qscriptdebuggerjob_p.h index 90f82a8..4fa0f91 100644 --- a/src/scripttools/debugging/qscriptdebuggerjob_p.h +++ b/src/scripttools/debugging/qscriptdebuggerjob_p.h @@ -54,6 +54,7 @@ // #include <QtCore/qobjectdefs.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE @@ -76,7 +77,7 @@ public: protected: QScriptDebuggerJob(QScriptDebuggerJobPrivate &dd); - QScriptDebuggerJobPrivate *d_ptr; + QScopedPointer<QScriptDebuggerJobPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptDebuggerJob) diff --git a/src/scripttools/debugging/qscriptdebuggerresponse.cpp b/src/scripttools/debugging/qscriptdebuggerresponse.cpp index 0ad9e75..2fd6f37 100644 --- a/src/scripttools/debugging/qscriptdebuggerresponse.cpp +++ b/src/scripttools/debugging/qscriptdebuggerresponse.cpp @@ -101,7 +101,6 @@ QScriptDebuggerResponse::QScriptDebuggerResponse(const QScriptDebuggerResponse & QScriptDebuggerResponse::~QScriptDebuggerResponse() { - delete d_ptr; } QScriptDebuggerResponse &QScriptDebuggerResponse::operator=(const QScriptDebuggerResponse &other) @@ -320,7 +319,7 @@ bool QScriptDebuggerResponse::operator!=(const QScriptDebuggerResponse &other) c */ QDataStream &operator<<(QDataStream &out, const QScriptDebuggerResponse &response) { - const QScriptDebuggerResponsePrivate *d = response.d_ptr; + const QScriptDebuggerResponsePrivate *d = response.d_ptr.data(); out << (quint32)d->error; out << d->result; out << d->async; @@ -336,7 +335,7 @@ QDataStream &operator<<(QDataStream &out, const QScriptDebuggerResponse &respons */ QDataStream &operator>>(QDataStream &in, QScriptDebuggerResponse &response) { - QScriptDebuggerResponsePrivate *d = response.d_ptr; + QScriptDebuggerResponsePrivate *d = response.d_ptr.data(); quint32 error; in >> error; diff --git a/src/scripttools/debugging/qscriptdebuggerresponse_p.h b/src/scripttools/debugging/qscriptdebuggerresponse_p.h index a63b0d5..723dd8e 100644 --- a/src/scripttools/debugging/qscriptdebuggerresponse_p.h +++ b/src/scripttools/debugging/qscriptdebuggerresponse_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qmap.h> #include <QtCore/qvariant.h> @@ -127,7 +127,7 @@ public: bool operator!=(const QScriptDebuggerResponse &other) const; private: - QScriptDebuggerResponsePrivate *d_ptr; + QScopedPointer<QScriptDebuggerResponsePrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerResponse) }; diff --git a/src/scripttools/debugging/qscriptdebuggervalue.cpp b/src/scripttools/debugging/qscriptdebuggervalue.cpp index cf518dc..12f837a 100644 --- a/src/scripttools/debugging/qscriptdebuggervalue.cpp +++ b/src/scripttools/debugging/qscriptdebuggervalue.cpp @@ -94,7 +94,7 @@ QScriptDebuggerValue::QScriptDebuggerValue(const QScriptValue &value) : d_ptr(0) { if (value.isValid()) { - d_ptr = new QScriptDebuggerValuePrivate; + d_ptr.reset(new QScriptDebuggerValuePrivate); if (value.isUndefined()) d_ptr->type = UndefinedValue; else if (value.isNull()) @@ -157,7 +157,7 @@ QScriptDebuggerValue::QScriptDebuggerValue(ValueType type) } QScriptDebuggerValue::QScriptDebuggerValue(const QScriptDebuggerValue &other) - : d_ptr(other.d_ptr) + : d_ptr(other.d_ptr.data()) { if (d_ptr) d_ptr->ref.ref(); @@ -165,21 +165,11 @@ QScriptDebuggerValue::QScriptDebuggerValue(const QScriptDebuggerValue &other) QScriptDebuggerValue::~QScriptDebuggerValue() { - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } } QScriptDebuggerValue &QScriptDebuggerValue::operator=(const QScriptDebuggerValue &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) - delete d_ptr; - d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); + d_ptr.assign(other.d_ptr.data()); return *this; } diff --git a/src/scripttools/debugging/qscriptdebuggervalue_p.h b/src/scripttools/debugging/qscriptdebuggervalue_p.h index d0ac720..a08b923 100644 --- a/src/scripttools/debugging/qscriptdebuggervalue_p.h +++ b/src/scripttools/debugging/qscriptdebuggervalue_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qlist.h> QT_BEGIN_NAMESPACE @@ -103,7 +103,7 @@ public: bool operator!=(const QScriptDebuggerValue &other) const; private: - QScriptDebuggerValuePrivate *d_ptr; + QScopedSharedPointer<QScriptDebuggerValuePrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerValue) }; diff --git a/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp b/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp index aaf637f..7f4708b 100644 --- a/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp +++ b/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp @@ -106,7 +106,7 @@ QScriptDebuggerValueProperty::QScriptDebuggerValueProperty(const QString &name, Constructs a QScriptDebuggerValueProperty that is a copy of the \a other property. */ QScriptDebuggerValueProperty::QScriptDebuggerValueProperty(const QScriptDebuggerValueProperty &other) - : d_ptr(other.d_ptr) + : d_ptr(other.d_ptr.data()) { if (d_ptr) d_ptr->ref.ref(); @@ -117,10 +117,6 @@ QScriptDebuggerValueProperty::QScriptDebuggerValueProperty(const QScriptDebugger */ QScriptDebuggerValueProperty::~QScriptDebuggerValueProperty() { - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } } /*! @@ -128,13 +124,7 @@ QScriptDebuggerValueProperty::~QScriptDebuggerValueProperty() */ QScriptDebuggerValueProperty &QScriptDebuggerValueProperty::operator=(const QScriptDebuggerValueProperty &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) - delete d_ptr; - d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); + d_ptr.assign(other.d_ptr.data()); return *this; } diff --git a/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h b/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h index 36d5c55..43a5be6 100644 --- a/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h +++ b/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h @@ -55,6 +55,7 @@ #include <QtCore/qobjectdefs.h> #include <QtCore/qlist.h> +#include <QtCore/qscopedpointer.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_NAMESPACE @@ -85,7 +86,7 @@ public: bool isValid() const; private: - QScriptDebuggerValuePropertyPrivate *d_ptr; + QScopedSharedPointer<QScriptDebuggerValuePropertyPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerValueProperty) }; diff --git a/src/scripttools/debugging/qscriptscriptdata.cpp b/src/scripttools/debugging/qscriptscriptdata.cpp index 5194a8b..d9d93a9 100644 --- a/src/scripttools/debugging/qscriptscriptdata.cpp +++ b/src/scripttools/debugging/qscriptscriptdata.cpp @@ -98,7 +98,7 @@ QScriptScriptData::QScriptScriptData(const QString &contents, const QString &fil } QScriptScriptData::QScriptScriptData(const QScriptScriptData &other) - : d_ptr(other.d_ptr) + : d_ptr(other.d_ptr.data()) { if (d_ptr) d_ptr->ref.ref(); @@ -106,21 +106,11 @@ QScriptScriptData::QScriptScriptData(const QScriptScriptData &other) QScriptScriptData::~QScriptScriptData() { - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } } QScriptScriptData &QScriptScriptData::operator=(const QScriptScriptData &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) - delete d_ptr; - d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); + d_ptr.assign(other.d_ptr.data()); return *this; } @@ -191,7 +181,7 @@ bool QScriptScriptData::operator!=(const QScriptScriptData &other) const QDataStream &operator<<(QDataStream &out, const QScriptScriptData &data) { - const QScriptScriptDataPrivate *d = data.d_ptr; + const QScriptScriptDataPrivate *d = data.d_ptr.data(); if (d) { out << d->contents; out << d->fileName; @@ -207,10 +197,10 @@ QDataStream &operator<<(QDataStream &out, const QScriptScriptData &data) QDataStream &operator>>(QDataStream &in, QScriptScriptData &data) { if (!data.d_ptr) { - data.d_ptr = new QScriptScriptDataPrivate(); + data.d_ptr.reset(new QScriptScriptDataPrivate()); data.d_ptr->ref.ref(); } - QScriptScriptDataPrivate *d = data.d_ptr; + QScriptScriptDataPrivate *d = data.d_ptr.data(); in >> d->contents; in >> d->fileName; qint32 ln; diff --git a/src/scripttools/debugging/qscriptscriptdata_p.h b/src/scripttools/debugging/qscriptscriptdata_p.h index 40394f4..bc6aa9f 100644 --- a/src/scripttools/debugging/qscriptscriptdata_p.h +++ b/src/scripttools/debugging/qscriptscriptdata_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> - +#include <QtCore/qscopedpointer.h> #include <QtCore/qdatetime.h> #include <QtCore/qmap.h> @@ -91,7 +91,7 @@ public: bool operator!=(const QScriptScriptData &other) const; private: - QScriptScriptDataPrivate *d_ptr; + QScopedSharedPointer<QScriptScriptDataPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptScriptData) }; diff --git a/src/scripttools/debugging/qscriptstdmessagehandler.cpp b/src/scripttools/debugging/qscriptstdmessagehandler.cpp index 5fb2db9..d2aa1cf 100644 --- a/src/scripttools/debugging/qscriptstdmessagehandler.cpp +++ b/src/scripttools/debugging/qscriptstdmessagehandler.cpp @@ -66,7 +66,6 @@ QScriptStdMessageHandler::QScriptStdMessageHandler() QScriptStdMessageHandler::~QScriptStdMessageHandler() { - delete d_ptr; } void QScriptStdMessageHandler::message(QtMsgType type, const QString &text, diff --git a/src/scripttools/debugging/qscriptstdmessagehandler_p.h b/src/scripttools/debugging/qscriptstdmessagehandler_p.h index 899f61d..d7e36de 100644 --- a/src/scripttools/debugging/qscriptstdmessagehandler_p.h +++ b/src/scripttools/debugging/qscriptstdmessagehandler_p.h @@ -53,6 +53,8 @@ // We mean it. // +#include <QtCore/qscopedpointer.h> + #include "qscriptmessagehandlerinterface_p.h" QT_BEGIN_NAMESPACE @@ -71,7 +73,7 @@ public: const QVariant &data = QVariant()); private: - QScriptStdMessageHandlerPrivate *d_ptr; + QScopedPointer<QScriptStdMessageHandlerPrivate> d_ptr; private: Q_DECLARE_PRIVATE(QScriptStdMessageHandler) diff --git a/src/scripttools/debugging/qscriptvalueproperty.cpp b/src/scripttools/debugging/qscriptvalueproperty.cpp index 5f7e563..eeab20e 100644 --- a/src/scripttools/debugging/qscriptvalueproperty.cpp +++ b/src/scripttools/debugging/qscriptvalueproperty.cpp @@ -95,7 +95,7 @@ QScriptValueProperty::QScriptValueProperty(const QString &name, Constructs a QScriptValueProperty that is a copy of the \a other property. */ QScriptValueProperty::QScriptValueProperty(const QScriptValueProperty &other) - : d_ptr(other.d_ptr) + : d_ptr(other.d_ptr.data()) { if (d_ptr) d_ptr->ref.ref(); @@ -106,10 +106,6 @@ QScriptValueProperty::QScriptValueProperty(const QScriptValueProperty &other) */ QScriptValueProperty::~QScriptValueProperty() { - if (d_ptr && !d_ptr->ref.deref()) { - delete d_ptr; - d_ptr = 0; - } } /*! @@ -117,13 +113,7 @@ QScriptValueProperty::~QScriptValueProperty() */ QScriptValueProperty &QScriptValueProperty::operator=(const QScriptValueProperty &other) { - if (d_ptr == other.d_ptr) - return *this; - if (d_ptr && !d_ptr->ref.deref()) - delete d_ptr; - d_ptr = other.d_ptr; - if (d_ptr) - d_ptr->ref.ref(); + d_ptr.assign(other.d_ptr.data()); return *this; } diff --git a/src/scripttools/debugging/qscriptvalueproperty_p.h b/src/scripttools/debugging/qscriptvalueproperty_p.h index c11c2d3..e487ba5 100644 --- a/src/scripttools/debugging/qscriptvalueproperty_p.h +++ b/src/scripttools/debugging/qscriptvalueproperty_p.h @@ -55,6 +55,7 @@ #include <QtCore/qobjectdefs.h> #include <QtCore/qlist.h> +#include <QtCore/qscopedpointer.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_NAMESPACE @@ -81,7 +82,7 @@ public: bool isValid() const; private: - QScriptValuePropertyPrivate *d_ptr; + QScopedSharedPointer<QScriptValuePropertyPrivate> d_ptr; Q_DECLARE_PRIVATE(QScriptValueProperty) }; diff --git a/src/scripttools/scripttools.pro b/src/scripttools/scripttools.pro index faf0936a..5878db2 100644 --- a/src/scripttools/scripttools.pro +++ b/src/scripttools/scripttools.pro @@ -10,3 +10,5 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript include(../qbase.pri) include(debugging/debugging.pri) + +symbian:TARGET.UID3=0x2001E625 |