Re: Memory leaks and destruction of widgets



Paul Davis <pbd Op Net> writes:
> >When a widget is destroyed, it seems that I have to explicitly remove the
> >tooltip set for it to reclaim the memory taken up by the tooltip (by setting
> >with a NULL tooltip). Shouldn't this be done when the widget is destroyed so
> >I don't have to explicitly call this myself?
> >
> >Are there any other `hidden' procedures that I have to go through to ensure
> >that all the memory taken up by the life of a widget is reclaimed, with
> >removing tooltips being one example?
> 
> this is not a "hidden" procedure. the tooltip knows about the widget,
> but the widget knows nothing about the tooltip. you associated the
> tooltip with the widget; you get to clean up later.  just connect a
> cleanup handler to the "destroy" event for the widget each time you
> make such an "anonymous" association between objects.
> 

The idea is that you have one GtkTooltips object for all your
widgets. So you just free it when you free the toplevel application
window or whatever.

Havoc




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