[PD-dev] deadly leak

Ivica Ico Bukvic ico at vt.edu
Thu Dec 15 00:10:35 CET 2011


> Deadly leak hits me, and my students, regularly and annoyingly when we
> are patching in a certain way.
> 
> I don't know about other bugs.  This one is really not as convoluted
> as you suggest -- its fatal consequences are, perhaps, but not the bug
> itself.
> 
> The real source of the bug is not freeing the GOP's editor.  The fix
> is either to free it, for example by a recursive traversal in
> canvas_destroy_editor(), or to rework the g_text.c so as not to need
> the editor in the first place.
> 
> The editor is created whenever there is a gatom inside of a GOP --
> because vised gatoms use text responders (aka rtexts).
> 
> For the time being the workaround, when patching, is not using rtexts
> (read: gatoms) in a GOP.
> 
> Krzysztof

Wow! You just helped me finally solve this riddle! Could it be really
this simple? In canvas_free() call inside g_canvas.c simply add the
following 2 lines:

	if (x->gl_editor)
		canvas_destroy_editor(x);

I added them right below

    if (x == glist_getcanvas(x))
        canvas_vis(x, 0);

Now even if the canvas is recreated with the same memory space there is
no more double-entry bug. Are there any potential regressions with this
model? The canvas is getting freed so I cannot imagine this posing any
problems but then again I am sure I may be missing something...

Any thoughts?




More information about the Pd-dev mailing list