summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripttools/debugging')
-rw-r--r--src/scripttools/debugging/qscriptbreakpointdata.cpp5
-rw-r--r--src/scripttools/debugging/qscriptbreakpointdata_p.h4
-rw-r--r--src/scripttools/debugging/qscriptcompletiontask.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebugger.cpp5
-rw-r--r--src/scripttools/debugging/qscriptdebuggeragent.cpp11
-rw-r--r--src/scripttools/debugging/qscriptdebuggeragent_p.h1
-rw-r--r--src/scripttools/debugging/qscriptdebuggeragent_p_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerbackend.cpp14
-rw-r--r--src/scripttools/debugging/qscriptdebuggerbackend_p.h2
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommand.cpp5
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommand_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp1
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h3
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsole.cpp1
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsole_p.h3
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommand.cpp1
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata.cpp14
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp1
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp3
-rw-r--r--src/scripttools/debugging/qscriptdebuggerevent.cpp6
-rw-r--r--src/scripttools/debugging/qscriptdebuggerevent_p.h3
-rw-r--r--src/scripttools/debugging/qscriptdebuggerfrontend.cpp1
-rw-r--r--src/scripttools/debugging/qscriptdebuggerfrontend_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerjob.cpp1
-rw-r--r--src/scripttools/debugging/qscriptdebuggerjob_p.h3
-rw-r--r--src/scripttools/debugging/qscriptdebuggerresponse.cpp5
-rw-r--r--src/scripttools/debugging/qscriptdebuggerresponse_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerstackmodel.cpp11
-rw-r--r--src/scripttools/debugging/qscriptdebuggervalue.cpp16
-rw-r--r--src/scripttools/debugging/qscriptdebuggervalue_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggervalueproperty.cpp14
-rw-r--r--src/scripttools/debugging/qscriptdebuggervalueproperty_p.h3
-rw-r--r--src/scripttools/debugging/qscriptedit.cpp18
-rw-r--r--src/scripttools/debugging/qscriptedit_p.h1
-rw-r--r--src/scripttools/debugging/qscriptscriptdata.cpp20
-rw-r--r--src/scripttools/debugging/qscriptscriptdata_p.h4
-rw-r--r--src/scripttools/debugging/qscriptstdmessagehandler.cpp1
-rw-r--r--src/scripttools/debugging/qscriptstdmessagehandler_p.h4
-rw-r--r--src/scripttools/debugging/qscriptvalueproperty.cpp14
-rw-r--r--src/scripttools/debugging/qscriptvalueproperty_p.h3
44 files changed, 101 insertions, 137 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/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp
index d228745..1288991 100644
--- a/src/scripttools/debugging/qscriptcompletiontask.cpp
+++ b/src/scripttools/debugging/qscriptcompletiontask.cpp
@@ -76,6 +76,8 @@ public:
};
QScriptCompletionTaskPrivate::QScriptCompletionTaskPrivate()
+ : cursorPosition(0), frameIndex(0), commandScheduler(0),
+ jobScheduler(0), console(0)
{
}
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp
index 40f4d6c..a316894 100644
--- a/src/scripttools/debugging/qscriptdebugger.cpp
+++ b/src/scripttools/debugging/qscriptdebugger.cpp
@@ -993,7 +993,8 @@ public:
m_debugger->scriptsModel->addScript(scriptId, data);
// ### could be slow, might want to do this in a separate thread
- QString xml = qt_scriptToXml(data.contents(), data.baseLineNumber());
+// Q_ASSERT_X(false, Q_FUNC_INFO, "implement me");
+ QString xml; // = qt_scriptToXml(data.contents(), data.baseLineNumber());
QScriptXmlParser::Result extraInfo = QScriptXmlParser::parse(xml);
m_debugger->scriptsModel->addExtraScriptInfo(
scriptId, extraInfo.functionsInfo, extraInfo.executableLineNumbers);
@@ -1018,7 +1019,7 @@ class SyncBreakpointsJob : public QScriptDebuggerCommandSchedulerJob
public:
SyncBreakpointsJob(QScriptDebuggerPrivate *debugger)
: QScriptDebuggerCommandSchedulerJob(debugger),
- m_debugger(debugger) {}
+ m_debugger(debugger), m_index(-1) {}
void start()
{
QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp
index a263f8a..3fc9d7b 100644
--- a/src/scripttools/debugging/qscriptdebuggeragent.cpp
+++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp
@@ -61,11 +61,11 @@ QT_BEGIN_NAMESPACE
*/
QScriptDebuggerAgentPrivate::QScriptDebuggerAgentPrivate()
+ : state(NoState), stepDepth(0), stepCount(0),
+ targetScriptId(-1), targetLineNumber(-1), returnCounter(0),
+ nextBreakpointId(1), hitBreakpointId(0),
+ nextContextId(0), statementCounter(0)
{
- state = NoState;
- nextBreakpointId = 1;
- nextContextId = 0;
- statementCounter = 0;
}
QScriptDebuggerAgentPrivate::~QScriptDebuggerAgentPrivate()
@@ -88,7 +88,7 @@ QScriptDebuggerAgentPrivate *QScriptDebuggerAgentPrivate::get(
*/
QScriptDebuggerAgent::QScriptDebuggerAgent(
QScriptDebuggerBackendPrivate *backend, QScriptEngine *engine)
- : QScriptEngineAgent(*new QScriptDebuggerAgentPrivate, engine)
+ : QScriptEngineAgent(engine), d_ptr(new QScriptDebuggerAgentPrivate())
{
Q_D(QScriptDebuggerAgent);
d->backend = backend;
@@ -110,6 +110,7 @@ QScriptDebuggerAgent::~QScriptDebuggerAgent()
Q_D(QScriptDebuggerAgent);
if (d->backend)
d->backend->agentDestroyed(this);
+ delete d;
}
/*!
diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p.h
index da06726..805efc1 100644
--- a/src/scripttools/debugging/qscriptdebuggeragent_p.h
+++ b/src/scripttools/debugging/qscriptdebuggeragent_p.h
@@ -125,6 +125,7 @@ public:
const QVariant &argument = QVariant());
private:
+ QScriptDebuggerAgentPrivate *d_ptr;
Q_DECLARE_PRIVATE(QScriptDebuggerAgent)
Q_DISABLE_COPY(QScriptDebuggerAgent)
};
diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h
index 7c229a4..09d0121 100644
--- a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h
+++ b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h
@@ -53,8 +53,6 @@
// We mean it.
//
-#include <private/qscriptengineagent_p.h>
-
#include <QtScript/qscriptvalue.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qhash.h>
@@ -68,9 +66,7 @@ QT_BEGIN_NAMESPACE
class QScriptDebuggerAgent;
class QScriptDebuggerAgentPrivate
- : public QScriptEngineAgentPrivate
{
- Q_DECLARE_PUBLIC(QScriptDebuggerAgent)
public:
enum State {
NoState,
diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp
index 3a5b400..63382d0 100644
--- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp
@@ -131,14 +131,13 @@ private:
QScriptDebuggerBackendPrivate::QScriptDebuggerBackendPrivate()
+ : agent(0), commandExecutor(0),
+ pendingEvaluateContextIndex(-1), pendingEvaluateLineNumber(-1),
+ ignoreExceptions(false),
+ nextScriptValueIteratorId(0), nextScriptObjectSnapshotId(0),
+ eventReceiver(0),
+ q_ptr(0) // q_ptr will be set later by QScriptDebuggerBackend constructor
{
- eventReceiver = 0;
- agent = 0;
- commandExecutor = 0;
- pendingEvaluateLineNumber = -1;
- ignoreExceptions = false;
- nextScriptValueIteratorId = 0;
- nextScriptObjectSnapshotId = 0;
}
QScriptDebuggerBackendPrivate::~QScriptDebuggerBackendPrivate()
@@ -385,7 +384,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/qscriptdebuggerconsoleglobalobject.cpp b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp
index adb4f33..73049d5 100644
--- a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp
@@ -361,6 +361,7 @@ void QScriptDebuggerConsoleGlobalObject::warning(const QString &text,
int lineNumber, int columnNumber)
{
Q_D(QScriptDebuggerConsoleGlobalObject);
+ Q_ASSERT(d->messageHandler != 0);
d->messageHandler->message(QtWarningMsg, text, fileName, lineNumber, columnNumber);
}
@@ -369,6 +370,7 @@ void QScriptDebuggerConsoleGlobalObject::message(const QString &text,
int lineNumber, int columnNumber)
{
Q_D(QScriptDebuggerConsoleGlobalObject);
+ Q_ASSERT(d->messageHandler != 0);
d->messageHandler->message(QtDebugMsg, text, fileName, lineNumber, columnNumber);
}
@@ -377,6 +379,7 @@ void QScriptDebuggerConsoleGlobalObject::error(const QString &text,
int lineNumber, int columnNumber)
{
Q_D(QScriptDebuggerConsoleGlobalObject);
+ Q_ASSERT(d->messageHandler != 0);
d->messageHandler->message(QtCriticalMsg, text, fileName, lineNumber, columnNumber);
}
diff --git a/src/scripttools/debugging/qscriptdebuggerevent.cpp b/src/scripttools/debugging/qscriptdebuggerevent.cpp
index ce08c9d..393f7a9 100644
--- a/src/scripttools/debugging/qscriptdebuggerevent.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerevent.cpp
@@ -60,6 +60,7 @@ public:
};
QScriptDebuggerEventPrivate::QScriptDebuggerEventPrivate()
+ : type(QScriptDebuggerEvent::None)
{
}
@@ -97,7 +98,6 @@ QScriptDebuggerEvent::QScriptDebuggerEvent(const QScriptDebuggerEvent &other)
QScriptDebuggerEvent::~QScriptDebuggerEvent()
{
- delete d_ptr;
}
QScriptDebuggerEvent &QScriptDebuggerEvent::operator=(const QScriptDebuggerEvent &other)
@@ -276,7 +276,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 +296,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/qscriptdebuggerscriptedconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp
index 167053d..a6096f2 100644
--- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp
@@ -367,7 +367,7 @@ class QScriptDebuggerScriptedConsoleCommandJobPrivate
: public QScriptDebuggerConsoleCommandJobPrivate
{
public:
- QScriptDebuggerScriptedConsoleCommandJobPrivate() {}
+ QScriptDebuggerScriptedConsoleCommandJobPrivate() : command(0), commandCount(0) {}
~QScriptDebuggerScriptedConsoleCommandJobPrivate() {}
QScriptDebuggerScriptedConsoleCommandPrivate *command;
diff --git a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp
index 651b062..a6bb78b 100644
--- a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp
@@ -131,11 +131,14 @@ QVariant QScriptDebuggerStackModel::data(const QModelIndex &index, int role) con
name = QString::fromLatin1("<anonymous>");
return name;
} else if (index.column() == 2) {
- if (info.lineNumber() == -1)
- return QString::fromLatin1("<native>");
QString fn = QFileInfo(info.fileName()).fileName();
- if (fn.isEmpty())
- fn = QString::fromLatin1("<anonymous script, id=%0>").arg(info.scriptId());
+ if (fn.isEmpty()) {
+ if (info.functionType() == QScriptContextInfo::ScriptFunction)
+ fn = QString::fromLatin1("<anonymous script, id=%0>").arg(info.scriptId());
+ else
+ fn = QString::fromLatin1("<native>");
+
+ }
return QString::fromLatin1("%0:%1").arg(fn).arg(info.lineNumber());
}
} else if (role == Qt::ToolTipRole) {
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/qscriptedit.cpp b/src/scripttools/debugging/qscriptedit.cpp
index 4f76695..a0c7199 100644
--- a/src/scripttools/debugging/qscriptedit.cpp
+++ b/src/scripttools/debugging/qscriptedit.cpp
@@ -156,6 +156,16 @@ void QScriptEdit::setExecutableLineNumbers(const QSet<int> &lineNumbers)
m_executableLineNumbers = lineNumbers;
}
+bool QScriptEdit::isExecutableLine(int lineNumber) const
+{
+#if 0 // ### enable me once we have information about the script again
+ return m_executableLineNumbers.contains(lineNumber);
+#else
+ Q_UNUSED(lineNumber);
+ return true;
+#endif
+}
+
int QScriptEdit::currentLineNumber() const
{
return textCursor().blockNumber() + m_baseLineNumber;
@@ -342,7 +352,7 @@ void QScriptEdit::extraAreaPaintEvent(QPaintEvent *e)
icon.paint(&painter, r, Qt::AlignCenter);
}
- if (!m_executableLineNumbers.contains(lineNumber))
+ if (!isExecutableLine(lineNumber))
painter.setPen(pal.color(QPalette::Mid));
else
painter.setPen(QColor(Qt::darkCyan));
@@ -369,7 +379,7 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e)
if (e->type() == QEvent::MouseMove && e->buttons() == 0) { // mouse tracking
bool hand = (e->pos().x() <= markWidth);
int lineNumber = cursor.blockNumber() + m_baseLineNumber;
- hand = hand && m_executableLineNumbers.contains(lineNumber);
+ hand = hand && isExecutableLine(lineNumber);
#ifndef QT_NO_CURSOR
if (hand != (m_extraArea->cursor().shape() == Qt::PointingHandCursor))
m_extraArea->setCursor(hand ? Qt::PointingHandCursor : Qt::ArrowCursor);
@@ -379,7 +389,7 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e)
if (e->type() == QEvent::MouseButtonPress) {
if (e->button() == Qt::LeftButton) {
int lineNumber = cursor.blockNumber() + m_baseLineNumber;
- bool executable = m_executableLineNumbers.contains(lineNumber);
+ bool executable = isExecutableLine(lineNumber);
if ((e->pos().x() <= markWidth) && executable)
m_extraAreaToggleBlockNumber = cursor.blockNumber();
else
@@ -394,7 +404,7 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e)
}
} else if (e->button() == Qt::RightButton) {
int lineNumber = cursor.blockNumber() + m_baseLineNumber;
- if (!m_executableLineNumbers.contains(lineNumber))
+ if (!isExecutableLine(lineNumber))
return;
bool has = m_breakpoints.contains(lineNumber);
QMenu *popup = new QMenu();
diff --git a/src/scripttools/debugging/qscriptedit_p.h b/src/scripttools/debugging/qscriptedit_p.h
index 2db2d7c..ee3dfc1 100644
--- a/src/scripttools/debugging/qscriptedit_p.h
+++ b/src/scripttools/debugging/qscriptedit_p.h
@@ -75,6 +75,7 @@ public:
int executionLineNumber() const;
void setExecutionLineNumber(int lineNumber, bool error);
void setExecutableLineNumbers(const QSet<int> &lineNumbers);
+ bool isExecutableLine(int lineNumber) const;
int currentLineNumber() const;
void gotoLine(int lineNumber);
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)
};