On Jul 27, 2010, at 3:35 PM, Krzysztof KosiĆski wrote:
It turns out that the author of the dialog was thinking correctly but did not know that some Inkscape APIs were braindead. The undo spam was triggered because the undo key passed to sp_document_maybe_done was dynamically created in a Glib::ustring, and that function expects a constant string. I fixed it to store a duplicate of the last undo action key in SPDocument (via g_strdup), rather than simply assigning a char pointer. The destructor was adjusted as well.
Good catch.
There are a few things about the code, though. First of all the API was not "braindead", there was just an improper bit of implementation code. But more important is that the fix needs a few things. First of all is g_strdup(). We really need to avoid having that in any C++ code. Next is that you had an if statement without any braces around its body.
Aside from those code safety points, though, the fix looks good and we probably want a cleaned up version going into 0.48.