From dfa37a8fd34cf82904aa790dee8d3bebf8fb07ed Mon Sep 17 00:00:00 2001
From: Marco Bubke <marco.bubke@nokia.com>
Date: Wed, 9 Feb 2011 16:28:15 +0100
Subject: [PATCH] QmlDesigner.NodeInstances: Check if the path is already
 watched

---
 .../designercore/instances/nodeinstanceserver.cpp   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp
index 6d994ebffe0..ed24dd45de4 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp
@@ -489,15 +489,18 @@ Internal::ChildrenChangeEventFilter *NodeInstanceServer::childrenChangeEventFilt
 
 void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path)
 {
-    m_fileSystemWatcherHash.insert(path, ObjectPropertyPair(object, propertyName));
-    fileSystemWatcher()->addPath(path);
-
+    if (!m_fileSystemWatcherHash.contains(path)) {
+        m_fileSystemWatcherHash.insert(path, ObjectPropertyPair(object, propertyName));
+        fileSystemWatcher()->addPath(path);
+    }
 }
 
 void NodeInstanceServer::removeFilePropertyFromFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path)
 {
-    fileSystemWatcher()->removePath(path);
-    m_fileSystemWatcherHash.remove(path, ObjectPropertyPair(object, propertyName));
+    if (m_fileSystemWatcherHash.contains(path)) {
+        fileSystemWatcher()->removePath(path);
+        m_fileSystemWatcherHash.remove(path, ObjectPropertyPair(object, propertyName));
+    }
 }
 
 void NodeInstanceServer::refreshLocalFileProperty(const QString &path)
-- 
GitLab