From af090d63ab04ec73c7978ac8e8b3cc312c768c8f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 15 Jun 2009 14:57:29 +0200 Subject: small refactoring Preparing to make it work with remote debugging. --- .../debugging/qscriptdebuggerlocalsmodel.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp index e096ba8..3226262 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp +++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp @@ -136,6 +136,7 @@ public: const QScriptDebuggerValuePropertyList &props); void deleteObjectSnapshots(const QList &snapshotIds); + void deleteAllObjectSnapshots(); QScriptDebuggerJobSchedulerInterface *jobScheduler; QScriptDebuggerCommandSchedulerInterface *commandScheduler; @@ -151,6 +152,7 @@ QScriptDebuggerLocalsModelPrivate::QScriptDebuggerLocalsModelPrivate() QScriptDebuggerLocalsModelPrivate::~QScriptDebuggerLocalsModelPrivate() { + deleteAllObjectSnapshots(); delete invisibleRootNode; } @@ -240,6 +242,14 @@ void QScriptDebuggerLocalsModelPrivate::deleteObjectSnapshots(const QList snapshotIds; + for (int i = 0; i < invisibleRootNode->children.count(); ++i) + snapshotIds += findSnapshotIdsRecursively(invisibleRootNode->children.at(i)); + deleteObjectSnapshots(snapshotIds); +} + QScriptDebuggerLocalsModelPrivate *QScriptDebuggerLocalsModelPrivate::get(QScriptDebuggerLocalsModel *q) { return q->d_func(); @@ -442,13 +452,6 @@ QScriptDebuggerLocalsModel::QScriptDebuggerLocalsModel( QScriptDebuggerLocalsModel::~QScriptDebuggerLocalsModel() { - Q_D(QScriptDebuggerLocalsModel); - QList snapshotIds; - for (int i = 0; i < d->invisibleRootNode->children.count(); ++i) - snapshotIds += findSnapshotIdsRecursively(d->invisibleRootNode->children.at(i)); - QScriptDebuggerCommandSchedulerFrontend frontend(d->commandScheduler, 0); - for (int j = 0; j < snapshotIds.size(); ++j) - frontend.scheduleDeleteScriptObjectSnapshot(snapshotIds.at(j)); } QModelIndex QScriptDebuggerLocalsModelPrivate::addTopLevelObject(const QString &name, const QScriptDebuggerValue &object) -- cgit v0.12