Re: Canvas item destructors



> As far as I know, you have to delete the child items yourself. I don't
> think that manage() works with canvas items. But I don't use the canvas
> - maybe someone else knows.

>From an old paper on the gnome canvas
(http://www-128.ibm.com/developerworks/library/l-gnomenclature/index.html)
"Note that we don't bother to store the pointer to the line object as we
will not be needing it. When we wish to destroy it, we will always
destroy its group, which will destroy all its children including this
line."

So even without doing anything special (ref() or whatever), the C
version is supposed to automatically delete the item when the group gets
destroyed. I don't know what the C++ bindings do because all this part
if totally undocumented. The logical thing would be to do the same as in
C, but obviously, that does not work. Why is that, I can only speculate:
1) Bad bug in the C++ bindings
2) The C++ bindings change the way the canvas behaves
3) Some totally undocumented black magic is required for this to work
(please share incantation with me). 
4) I'm on crack (and so is everyone else I've asked so far)

I have uploaded a small file demonstrating the problem
http://people.xiph.org/~jm/fd/testitem.cpp 
When running it, I see the Canvas being destroyed (when I close the
window), but not the Rect.

	Jean-Marc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]