Re: [gtk-list] Re: gtk-- delete/destroy confusion
- From: Angel Jimenez Jimenez <ajimenez vnet es>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: gtk-- delete/destroy confusion
- Date: Thu, 28 May 1998 09:38:33 +0000
Tero Pulkkinen wrote:
> 2) never do delete this; :) (from any C++ textbook).
Err... Ok :) So, I can't use "delete this" from a method callback (I
still don't know exactly why).
> Thus always a parent widget will allocate/delete the widget. If you want
> objects own callback to destroy the object, make an Gtk_Main::idle_add() at
> the callback and make that delete the object. This way can be sure the
> object will not be referenced after it has been deleted.
We could also use a function callback, with a pointer to the object as
data, instead of a method callback. This is a problem when we want this
callback to do some operation in the object before deleting. For
example, I have a dialog with an 'OK' and a 'Cancel' button. There's no
problem with the cancel callback, but I want the ok callback to do
something with the dialog's internal data, so I would like it to be a
method (that's what GTK-- is for).
Can you give an example of using idle_add() for this?
Angel.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]