summaryrefslogtreecommitdiff
path: root/libs/pbd/undo.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-17 18:24:23 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-17 18:24:23 +0000
commitf6fdd8dcbf41f864e9f0cc32dabe81fe3533ddfe (patch)
tree5214c580b9e6c17a499fa587660dbf949e892bf2 /libs/pbd/undo.cc
parentda762129f19c28aff64f833b6ec09fba946faef6 (diff)
switch to using boost::signals2 instead of sigc++, at least for libardour. not finished yet, but compiles, loads sessions, records and can close a session without a crash
git-svn-id: svn://localhost/ardour2/branches/3.0@6372 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/undo.cc')
-rw-r--r--libs/pbd/undo.cc27
1 files changed, 6 insertions, 21 deletions
diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc
index a0e98f9a13..78c16291b7 100644
--- a/libs/pbd/undo.cc
+++ b/libs/pbd/undo.cc
@@ -46,7 +46,7 @@ UndoTransaction::UndoTransaction (const UndoTransaction& rhs)
UndoTransaction::~UndoTransaction ()
{
- GoingAway ();
+ drop_references ();
clear ();
}
@@ -78,9 +78,11 @@ void
UndoTransaction::add_command (Command *const action)
{
/* catch death of command (e.g. caused by death of object to
- which it refers.
+ which it refers. command_death() is a normal static function
+ so there is no need to manage this connection.
*/
- shivas.push_back (new PBD::ProxyShiva<Command,UndoTransaction> (*action, *this, &command_death));
+
+ scoped_connect (action->GoingAway, boost::bind (&command_death, this, action));
actions.push_back (action);
}
@@ -90,21 +92,6 @@ UndoTransaction::remove_command (Command* const action)
actions.remove (action);
}
-void
-UndoTransaction::about_to_explicitly_delete ()
-{
- /* someone is going to call our destructor and its not Shiva,
- the god of destruction and chaos. This happens when an UndoHistory
- is pruning itself. we must remove Shivas to avoid the god
- striking us down a second time, unnecessarily and illegally.
- */
-
- for (list<PBD::ProxyShiva<Command,UndoTransaction>*>::iterator i = shivas.begin(); i != shivas.end(); ++i) {
- delete *i;
- }
- shivas.clear ();
-}
-
bool
UndoTransaction::empty () const
{
@@ -188,7 +175,6 @@ UndoHistory::set_depth (uint32_t d)
while (cnt--) {
ut = UndoList.front();
UndoList.pop_front ();
- ut->about_to_explicitly_delete ();
delete ut;
}
}
@@ -199,7 +185,7 @@ UndoHistory::add (UndoTransaction* const ut)
{
uint32_t current_depth = UndoList.size();
- ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut));
+ scoped_connect (ut->GoingAway, boost::bind (&UndoHistory::remove, this, ut));
/* if the current undo history is larger than or equal to the currently
requested depth, then pop off at least 1 element to make space
@@ -214,7 +200,6 @@ UndoHistory::add (UndoTransaction* const ut)
UndoTransaction* ut;
ut = UndoList.front ();
UndoList.pop_front ();
- ut->about_to_explicitly_delete ();
delete ut;
}
}