[cl-gtk2-devel] gtk_widget_destroy

Kalyanov Dmitry kalyanov.dmitry at gmail.com
Fri Mar 4 03:52:33 UTC 2011


Hello,


> Normally, when writing GTK in C, after gtk_main() finishes, one does some
> various cleanup and exit(). This causes all the windows to go away.

Gtk+ does not do any cleanup on gtk_main_quit - it just ends its event
loop. Windows are destroyed by X11 server beacuse socket is closed by
the OS when process quits. To properly close all windows, you have to
something like this:

(gtk:within-main-loop (loop for w in (gtk:gtk-window-list-toplevels) do
(gtk:object-destroy w)))

You can use the gtk_quit_add_full function to register cleanup callback;
but cl-gtk2 does not have bindings for it.

You should also note that cl-gtk2 will use background thread for Gtk+
main event loop (if your lisp supports threads); (gtk:gtk-main) starts
the background thread and returns.





More information about the cl-gtk2-devel mailing list