complete clean up after gtk_main() returns?



Hi,

I have a program that temporarily uses a GUI (I'm using GTK+-2.2). The program
should continue running after gtk_main(). But when gtk_main() returns, the
program still has a connection to the X11 display.  By using the following line:

close(ConnectionNumber(gdk_x11_display_get_xdisplay(gdk_display_get_default())
);

I managed to close the X11 connection, but this looks like a hack to me for two
reasons:

1. this is X11 specific, and I would like to have a method to disconnect from
the GUI in a portable manner (if possible.)

2. this also suggests that when gtk_main() returns, the cleaning up is not
complete.

(The program should in fact run like a daemon (a server), that can open windows
temporarily on remote clients. It should also run even when no GUI is available)

Am I missing something? To summarise, I need to do a complete clean up and
disconnect from the GUI after gtk_main() returns, as if Gtk was never called.

I tried to run gdk_display_close(gdk_display_get_default()) after gtk_main()
returns, but I get a segmentation fault when gdk_display_close() calls
_gdk_windowing_set_default_display().


-- 
Melvin Hadasht



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