Code

Duplicate the undo key passed to sp_document_maybe_done, instead of simply
authorKrzysztof Kosiński <tweenk.pl@gmail.com>
Tue, 27 Jul 2010 22:29:47 +0000 (00:29 +0200)
committerKrzysztof Kosiński <tweenk.pl@gmail.com>
Tue, 27 Jul 2010 22:29:47 +0000 (00:29 +0200)
assigning it. Allows the function to be used with dynamically created
keys and fixes undo stack spam when adjusting filter parameter values
(LP #579932).

src/document-undo.cpp
src/document.cpp
src/document.h

index ae1c82e71f4e4d2e02b4ab2e6e480599ac26096f..62259fa1947f7c63fcf63c1d5cd0aa67b55482b7 100644 (file)
@@ -198,7 +198,9 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev
                doc->priv->undoStackObservers.notifyUndoCommitEvent(event);
        }
 
-       doc->actionkey = key;
+        if (doc->actionkey)
+            g_free(doc->actionkey);
+       doc->actionkey = key ? g_strdup(key) : NULL;
 
        doc->virgin = FALSE;
         doc->setModifiedSinceSave();
index eff6d6e818b86f9db51ef9a8e3f087e820deb9bf..eebc50a98891c1cfeebdc2ec4a35cc57af13e781 100644 (file)
@@ -211,7 +211,10 @@ SPDocument::~SPDocument() {
         inkscape_unref();
         keepalive = FALSE;
     }
-
+    if (actionkey) {
+        g_free(actionkey);
+        actionkey = NULL;
+    }
     //delete this->_whiteboard_session_manager;
 }
 
index e70582006f92ac3d2327d69ab4a19284923b0c49..bcc072f70b0db7ea1113564a5e3ee9f906b9d3fc 100644 (file)
@@ -96,7 +96,7 @@ struct SPDocument : public Inkscape::GC::Managed<>,
     SPDocumentPrivate *priv;
 
     /// Last action key
-    const gchar *actionkey;
+    gchar *actionkey;
     /// Handler ID
     guint modified_id;