summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/memento_command.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/pbd/memento_command.h')
-rw-r--r--libs/pbd/pbd/memento_command.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h
index c1e5d75f9c..c5e8b19272 100644
--- a/libs/pbd/pbd/memento_command.h
+++ b/libs/pbd/pbd/memento_command.h
@@ -26,7 +26,6 @@
#include "pbd/command.h"
#include "pbd/stacktrace.h"
#include "pbd/xml++.h"
-#include "pbd/shiva.h"
#include <sigc++/slot.h>
#include <typeinfo>
@@ -42,16 +41,20 @@ public:
MementoCommand(obj_T& a_object, XMLNode* a_before, XMLNode* a_after)
: obj(a_object), before(a_before), after(a_after)
{
- /* catch destruction of the object */
- new PBD::PairedShiva< obj_T,MementoCommand<obj_T> > (obj, *this);
+ /* if the object dies, make sure that we die and that everyone knows about it */
+ obj_death_connection = obj.GoingAway.connect (boost::bind (&MementoCommand::object_died, this));
}
~MementoCommand () {
- GoingAway(); /* EMIT SIGNAL */
+ drop_references ();
delete before;
delete after;
}
+ void object_died () {
+ delete this;
+ }
+
void operator() () {
if (after) {
obj.set_state(*after, Stateful::current_state_version);
@@ -94,6 +97,7 @@ protected:
obj_T& obj;
XMLNode* before;
XMLNode* after;
+ boost::signals2::scoped_connection obj_death_connection;
};
#endif // __lib_pbd_memento_h__