Re: Calling gtk_widget_destroy()
- From: Alexey Dokuchaev <danfe nsu ru>
- To: Stuart Brorson <sdb cloud9 net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Calling gtk_widget_destroy()
- Date: Sun, 12 Sep 2004 15:39:01 +0700
On Sat, Sep 11, 2004 at 11:55:19AM -0400, Stuart Brorson wrote:
As for your problem: when you click "delete_event", gtk_main calls
gtk_main_quit. Gtk_main_quit kills all its windows, and then returns
to gtk_main. Then, gtk_main returns, and you proceed to the next
statement gtk_window_destroy. However, all the windows are already
gone and the memory has already been freed! Therefore, you get a
segfault.
May I suppose this is not quite right what you're saying. If
gtk_main_quit() would destroy all widgets (windows) unconditionally,
like you described, clicking a button would lead to segfault as well.
On practice, this does not happen.
My current vision of pretty much entire situation is:
Gtk_main_quit() does not really call gtk_widget_destroy(). However,
since "delete_event" callback function (here, gtk_main_quit()) does
not return TRUE, gtk_widget_destroy() gets called later, supposedly
in "destroy" default handler, or "delete_event" itself (I'm not quite
sure at this time). When gtk_main_quit() hooked to some other event,
like "clicked", no one really cares what it returned, and no one calls
for gtk_widget_destroy(). That explains (at least for me) why closing
a window by clicking a button works, but closing it via windowmanager
explodes. (Here we speak of a program that calls gtk_widget_destroy()
after gtk_main().)
How does it sound to you?
Thanks!
./danfe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]