Re: [gtk-list] what's the opposite of the destroy signal?



jca <jca@mail.phm.vcu.edu> writes:
>   Is 'realize' the opposite of the destroy signal for a widget?
> 
>   In other words, if I create dynamic data on realize, and free it on
> destroy, it will never cause a memory leak?
> 

No, stuff created in realize should be destroyed in unrealize. Note
that widgets can be realized/unrealized multiple times, but
realize/unrealize always come in matched pairs.

In destroy() you can assume the widget is unrealized. 

GDK and X resources (things that require contacting the X server)
should be created in the realize method (or later, as long as you
check that the widget is realized) and destroyed in unrealize. Other
resources should be created in your _init() function, in your _new()
function, or simply whenever it's convenient, and destroyed in
destroy() or whenever you no longer need them.

Havoc





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