Crashbug on fixing XML node creation.
Hi all,
I am about to fix a bug in the code...
/display/canvas-grid.cpp line 229: newnode = xml_doc->createElement("inkscape:grid"); newnode->setAttribute("type", getSVGName(gridtype)); repr->appendChild(newnode); Inkscape::GC::release(repr); <--- this line should be there but isn't
When I add that GC::release line, a strange bug appears. When repeating grid creation and undoing by pressing the new button and then pressing ctrl+z, first it works fine, but after a number of repetitions Inkscape crashes (svnhead, WinXP). Can anyone shine light on this matter please?
(note that i did not yet commit this 'fix')
Cheers, Johan
On Thu, 5 Jul 2007 22:48:09 +0200, <J.B.C.Engelen@...1578...> wrote:
Hi all,
I am about to fix a bug in the code...
/display/canvas-grid.cpp line 229: newnode = xml_doc->createElement("inkscape:grid"); newnode->setAttribute("type", getSVGName(gridtype)); repr->appendChild(newnode); Inkscape::GC::release(repr); <--- this line should be there but isn't
When I add that GC::release line, a strange bug appears. When repeating grid creation and undoing by pressing the new button and then pressing ctrl+z, first it works fine, but after a number of repetitions Inkscape crashes (svnhead, WinXP). Can anyone shine light on this matter please?
It sounds like some SPObject is retaining a pointer to the inkscape:grid node after it has been removed from the document, but is not bothering to call GC::anchor on it to reflect the reference from the SPObject. That would often result in the node being prematurely freed, resulting in memory corruption.
If so, the unbalanced anchor count here was simply masking that bug at the cost of a memory leak.
-mental
participants (2)
-
unknown@example.com
-
MenTaLguY