From 8e66f19121ed96553dbe32034241373acff85986 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 28 Jul 2010 00:29:47 +0200 Subject: [PATCH] Duplicate the undo key passed to sp_document_maybe_done, instead of simply 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 | 4 +++- src/document.cpp | 5 ++++- src/document.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/document-undo.cpp b/src/document-undo.cpp index ae1c82e71..62259fa19 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -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(); diff --git a/src/document.cpp b/src/document.cpp index eff6d6e81..eebc50a98 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -211,7 +211,10 @@ SPDocument::~SPDocument() { inkscape_unref(); keepalive = FALSE; } - + if (actionkey) { + g_free(actionkey); + actionkey = NULL; + } //delete this->_whiteboard_session_manager; } diff --git a/src/document.h b/src/document.h index e70582006..bcc072f70 100644 --- a/src/document.h +++ b/src/document.h @@ -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; -- 2.30.2