diff view/ViewManager.cpp @ 762:b75c95e7f906 tonioni

Fix potential for crash on reloading session file - loading selections should not emit signal as if user had just made them manually
author Chris Cannam
date Thu, 03 Apr 2014 08:51:30 +0100
parents 56ba2b03508e
children c58569bd952e 4c8ca536b54f
line wrap: on
line diff
--- a/view/ViewManager.cpp	Wed Apr 02 21:50:04 2014 +0100
+++ b/view/ViewManager.cpp	Thu Apr 03 08:51:30 2014 +0100
@@ -258,6 +258,14 @@
 }
 
 void
+ViewManager::addSelectionQuietly(const Selection &selection)
+{
+    MultiSelection ms(m_selections);
+    ms.addSelection(selection);
+    setSelections(ms, true);
+}
+
+void
 ViewManager::removeSelection(const Selection &selection)
 {
     MultiSelection ms(m_selections);
@@ -274,12 +282,14 @@
 }
 
 void
-ViewManager::setSelections(const MultiSelection &ms)
+ViewManager::setSelections(const MultiSelection &ms, bool quietly)
 {
     if (m_selections.getSelections() == ms.getSelections()) return;
     SetSelectionCommand *command = new SetSelectionCommand(this, ms);
     CommandHistory::getInstance()->addCommand(command);
-    emit selectionChangedByUser();
+    if (!quietly) {
+        emit selectionChangedByUser();
+    }
 }
 
 size_t