Re: [gtk-list] what's the opposite of the destroy signal?
- From: Havoc Pennington <hp redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] what's the opposite of the destroy signal?
- Date: 16 Dec 1999 10:46:03 -0500
jca <email@example.com> 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.
] [Thread Prev