summaryrefslogtreecommitdiff
path: root/libs/pbd/undo.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-10-25 20:11:42 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-10-25 20:11:42 +0000
commitbcd511aa3fec59e1527c8b7ab80dabda4db1a6f9 (patch)
tree0e704409baaaa22a43b918adc126c76990208f5f /libs/pbd/undo.cc
parent1b39adc4ce8566fd731cf433094b1faf4fe63205 (diff)
fixes for endemic (compiler?) issues with virtual inheritance of sigc::trackable. NOTE: automation list undo/redo no longer operational, fix to follow
git-svn-id: svn://localhost/ardour2/trunk@1007 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/undo.cc')
-rw-r--r--libs/pbd/undo.cc37
1 files changed, 17 insertions, 20 deletions
diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc
index af408a24a4..442a5439f2 100644
--- a/libs/pbd/undo.cc
+++ b/libs/pbd/undo.cc
@@ -24,31 +24,13 @@
#include <pbd/undo.h>
#include <pbd/xml++.h>
+#include <pbd/shiva.h>
#include <sigc++/bind.h>
using namespace std;
using namespace sigc;
-/* grrr, strict C++ says that static member functions are not C functions, but we also want
- to be able to pack this into a sigc::ptr_fun and not sigc::mem_fun, so we have to make
- it a genuine function rather than a member.
-*/
-
-static void command_death (UndoTransaction* ut, Command* c)
-{
- if (ut->clearing()) {
- return;
- }
-
- ut->remove_command (c);
-
- if (ut->empty()) {
- delete ut;
- }
-}
-
-
UndoTransaction::UndoTransaction ()
{
_clearing = false;
@@ -68,6 +50,20 @@ UndoTransaction::~UndoTransaction ()
clear ();
}
+void
+command_death (UndoTransaction* ut, Command* c)
+{
+ if (ut->clearing()) {
+ return;
+ }
+
+ ut->remove_command (c);
+
+ if (ut->empty()) {
+ delete ut;
+ }
+}
+
UndoTransaction&
UndoTransaction::operator= (const UndoTransaction& rhs)
{
@@ -81,7 +77,8 @@ UndoTransaction::operator= (const UndoTransaction& rhs)
void
UndoTransaction::add_command (Command *const action)
{
- action->GoingAway.connect (bind (sigc::ptr_fun (command_death), this, const_cast<Command*>(action)));
+ /* catch death */
+ new PBD::ProxyShiva<Command,UndoTransaction> (*action, *this, &command_death);
actions.push_back (action);
}