break circular reference between panners and pannables; more destruction debug tracin...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Feb 2011 18:13:15 +0000 (18:13 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Feb 2011 18:13:15 +0000 (18:13 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8822 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/pannable.h
libs/ardour/pannable.cc
libs/ardour/panner.cc
libs/ardour/panner_shell.cc
libs/ardour/route.cc
libs/ardour/session.cc

index f7934e974db3d9cef2fa3763a368b27a07178add..c30bd0a0686402c153af56799e3440588351b2cc 100644 (file)
@@ -48,7 +48,7 @@ class Pannable : public PBD::Stateful, public Automatable, public SessionHandleR
         boost::shared_ptr<AutomationControl> pan_frontback_control;
         boost::shared_ptr<AutomationControl> pan_lfe_control;
         
-        boost::shared_ptr<Panner> panner() const { return _panner; }
+        boost::shared_ptr<Panner> panner() const { return _panner.lock(); }
         void set_panner(boost::shared_ptr<Panner>);
 
         Session& session() { return _session; }
@@ -83,7 +83,7 @@ class Pannable : public PBD::Stateful, public Automatable, public SessionHandleR
         bool has_state() const { return _has_state; }
 
   protected:
-        boost::shared_ptr<Panner> _panner;
+        boost::weak_ptr<Panner> _panner;
         AutoState _auto_state;
         AutoStyle _auto_style;
         gint      _touching;
index 1a56fe87cb7b421cc961068afc818e8a7996eeb2..b4744d5658e0bdedd652e2cae2e87d3e5e739f71 100644 (file)
@@ -256,8 +256,10 @@ Pannable::set_state (const XMLNode& root, int /*version - not used*/)
 string 
 Pannable::value_as_string (boost::shared_ptr<AutomationControl> ac) const
 {
-        if (_panner) {
-                return _panner->value_as_string (ac);
+        boost::shared_ptr<Panner> p = panner ();
+
+        if (p) {
+                return p->value_as_string (ac);
         } 
 
         return Automatable::value_as_string (ac);
index 9ad49c12c5808308c4a6d8fc9f0b60671a1b2f47..6498c2777aa0067aced09201d15d120a4956b452 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "ardour/audio_buffer.h"
 #include "ardour/buffer_set.h"
+#include "ardour/debug.h"
 #include "ardour/panner.h"
 #include "ardour/pannable.h"
 #include "ardour/session.h"
@@ -35,6 +36,7 @@ Panner::Panner (boost::shared_ptr<Pannable> p)
 
 Panner::~Panner ()
 {
+        DEBUG_TRACE(PBD::DEBUG::Destruction, string_compose ("panner @ %1 destructor, pannable is %2\n", this, _pannable));
 }
 
 void
index ffe8e66cebe59af31831f0c443abca1ecfb28e16..ecf7adf990cf8c0f896f84df425f75268fb29541 100644 (file)
@@ -33,6 +33,7 @@
 #include <glibmm.h>
 
 #include "pbd/cartesian.h"
+#include "pbd/boost_debug.h"
 #include "pbd/convert.h"
 #include "pbd/error.h"
 #include "pbd/failed_constructor.h"
@@ -45,6 +46,7 @@
 #include "ardour/audio_buffer.h"
 #include "ardour/automatable.h"
 #include "ardour/buffer_set.h"
+#include "ardour/debug.h"
 #include "ardour/pannable.h"
 #include "ardour/panner.h"
 #include "ardour/panner_manager.h"
@@ -70,6 +72,7 @@ PannerShell::PannerShell (string name, Session& s, boost::shared_ptr<Pannable> p
 
 PannerShell::~PannerShell ()
 {
+        DEBUG_TRACE(DEBUG::Destruction, string_compose ("panner shell for %1 destructor, pannable is %2\n", _name, _pannable));
 }
 
 void
@@ -101,7 +104,9 @@ PannerShell::configure_io (ChanCount in, ChanCount out)
                 abort ();
         }
 
-        _panner.reset (pi->descriptor.factory (_pannable, _session.get_speakers()));
+        Panner* p = pi->descriptor.factory (_pannable, _session.get_speakers());
+        boost_debug_shared_ptr_mark_interesting (p, "Panner");
+        _panner.reset (p);
         _panner->configure_io (in, out);
 
         Changed (); /* EMIT SIGNAL */
index 15907444f0ee19b81f93430c34b453992773c0c7..2e60f0fb767029894e73301558d0cc6f900a420e 100644 (file)
@@ -27,6 +27,7 @@
 #include "pbd/memento_command.h"
 #include "pbd/stacktrace.h"
 #include "pbd/convert.h"
+#include "pbd/boost_debug.h"
 
 #include "evoral/Curve.hpp"
 
@@ -118,7 +119,9 @@ Route::init ()
 
         /* panning */
         
-        _pannable.reset (new Pannable (_session));
+        Pannable* p = new Pannable (_session);
+       boost_debug_shared_ptr_mark_interesting (p, "Pannable");
+        _pannable.reset (p);
 
        /* input and output objects */
 
index e569188a387333531ecc42cabe8138945412f861..aa0b29ed1ee3793822f3664e19d91e1b372125d6 100644 (file)
@@ -323,12 +323,12 @@ Session::destroy ()
        /* not strictly necessary, but doing it here allows the shared_ptr debugging to work */
        playlists.reset ();
 
-       boost_debug_list_ptrs ();
-
        delete _locations;
         delete _speakers;
 
        DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
+
+       boost_debug_list_ptrs ();
 }
 
 void