diff framework/Document.cpp @ 686:610fa108fbcc by-id

Update for changes to PlayParameters
author Chris Cannam
date Thu, 04 Jul 2019 18:04:59 +0100
parents 0736beb8b852
children e0b0f3e163ca
line wrap: on
line diff
--- a/framework/Document.cpp	Thu Jul 04 14:31:22 2019 +0100
+++ b/framework/Document.cpp	Thu Jul 04 18:04:59 2019 +0100
@@ -554,6 +554,12 @@
 
     emit mainModelChanged(m_mainModel);
 
+    // Remove the playable explicitly - the main model's dtor will do
+    // this, but just in case something is still hanging onto a
+    // shared_ptr to the old main model so it doesn't get deleted yet
+    PlayParameterRepository::getInstance()->removePlayable
+        (oldMainModel.untyped);
+    
     ModelById::release(oldMainModel);
 }
 
@@ -1337,7 +1343,7 @@
             mainModel->toXml(out, indent + "  ", "mainModel=\"true\"");
         }
 
-        PlayParameters *playParameters =
+        auto playParameters =
             PlayParameterRepository::getInstance()->getPlayParameters
             (m_mainModel.untyped);
         if (playParameters) {
@@ -1484,8 +1490,7 @@
                                                   modelId, rec.second);
             }
 
-            //!!! We should probably own the PlayParameterRepository
-            PlayParameters *playParameters =
+            auto playParameters =
                 PlayParameterRepository::getInstance()->getPlayParameters
                 (modelId.untyped);
             if (playParameters) {