summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2009-10-14 05:46:37 (GMT)
committerBea Lam <bea.lam@nokia.com>2009-10-14 05:46:37 (GMT)
commitce33aa1fd8973cf066d0e5b8fc88971404d6b037 (patch)
treedce8c2576fe2eb8906224467b1663804631eeed0 /tools/qmldebugger
parentb57d6c247215aa5b1d78cb1ca72b794012113d00 (diff)
downloadQt-ce33aa1fd8973cf066d0e5b8fc88971404d6b037.zip
Qt-ce33aa1fd8973cf066d0e5b8fc88971404d6b037.tar.gz
Qt-ce33aa1fd8973cf066d0e5b8fc88971404d6b037.tar.bz2
Fix memory leak and remove redundant ContextIdRole.
Diffstat (limited to 'tools/qmldebugger')
-rw-r--r--tools/qmldebugger/objectpropertiesview.cpp22
-rw-r--r--tools/qmldebugger/objecttree.cpp4
-rw-r--r--tools/qmldebugger/objecttree.h4
3 files changed, 18 insertions, 12 deletions
diff --git a/tools/qmldebugger/objectpropertiesview.cpp b/tools/qmldebugger/objectpropertiesview.cpp
index 2237fbb..f725194 100644
--- a/tools/qmldebugger/objectpropertiesview.cpp
+++ b/tools/qmldebugger/objectpropertiesview.cpp
@@ -1,3 +1,5 @@
+#include <QtCore/qdebug.h>
+
#include <QtGui/qtreewidget.h>
#include <QtGui/qlayout.h>
@@ -53,6 +55,9 @@ ObjectPropertiesView::ObjectPropertiesView(QmlEngineDebug *client, QWidget *pare
void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj)
{
+ if (m_query)
+ delete m_query;
+
m_query = m_client->queryObjectRecursive(obj, this);
if (!m_query->isWaiting())
queryFinished();
@@ -63,16 +68,20 @@ void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj)
void ObjectPropertiesView::queryFinished()
{
- if (m_watch) {
- m_client->removeWatch(m_watch);
- delete m_watch;
- m_watch = 0;
- }
+ if (!m_query)
+ return;
QmlDebugObjectReference obj = m_query->object();
QmlDebugWatch *watch = m_client->addWatch(obj, this);
- if (watch->state() != QmlDebugWatch::Dead) {
+ if (watch->state() == QmlDebugWatch::Dead) {
+ delete watch;
+ watch = 0;
+ } else {
+ if (m_watch) {
+ m_client->removeWatch(m_watch);
+ delete m_watch;
+ }
m_watch = watch;
QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)),
this, SLOT(valueChanged(QByteArray,QVariant)));
@@ -89,6 +98,7 @@ void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object)
m_object = object;
m_tree->clear();
+
QList<QmlDebugPropertyReference> properties = object.properties();
for (int i=0; i<properties.count(); i++) {
const QmlDebugPropertyReference &p = properties[i];
diff --git a/tools/qmldebugger/objecttree.cpp b/tools/qmldebugger/objecttree.cpp
index f398987..f68e7f1 100644
--- a/tools/qmldebugger/objecttree.cpp
+++ b/tools/qmldebugger/objecttree.cpp
@@ -75,10 +75,10 @@ void ObjectTree::buildTree(const QmlDebugObjectReference &obj, QTreeWidgetItem *
QTreeWidgetItem *item = parent ? new QTreeWidgetItem(parent) : new QTreeWidgetItem(this);
item->setText(0, obj.className());
item->setData(0, Qt::UserRole, qVariantFromValue(obj));
- item->setData(0, ObjectTree::ContextIdRole, obj.contextDebugId());
if (parent && obj.contextDebugId() >= 0
- && obj.contextDebugId() != parent->data(0, ObjectTree::ContextIdRole).toInt()) {
+ && obj.contextDebugId() != parent->data(0, Qt::UserRole
+ ).value<QmlDebugObjectReference>().contextDebugId()) {
QmlDebugFileReference source = obj.source();
if (!source.url().isEmpty()) {
QString toolTipString = QLatin1String("URL: ") + source.url().toString();
diff --git a/tools/qmldebugger/objecttree.h b/tools/qmldebugger/objecttree.h
index a924ec5..bba6c08 100644
--- a/tools/qmldebugger/objecttree.h
+++ b/tools/qmldebugger/objecttree.h
@@ -17,10 +17,6 @@ class ObjectTree : public QTreeWidget
{
Q_OBJECT
public:
- enum AdditionalRoles {
- ContextIdRole = Qt::UserRole + 1
- };
-
ObjectTree(QmlEngineDebug *client, QWidget *parent = 0);
signals: