Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] lablgtk question: catching server shutdown
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-07 (08:45)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] lablgtk question: catching server shutdown
From: Hendrik Tews <>

> I have a lablgtk question:
> Is there a canonical way to register a function that will be
> called when the connection to the X server is lost?
> I looked at the gtk sources (version 1.2.9) and there they
> register the function gdk_x_io_error with XSetIOErrorHandler. And
> gdk_x_io_error prints 
>   Gdk-ERROR **: X connection to :0.0 broken (explicit kill or server shutdown).
> and calls exit. So it looks like there is no way to register a
> callback for this event. Am I right?

You can try to add a bit of C code to your application, and call
XSetIOErrorHandler after GDK is initialized, to override this default.
However, they probably have good reasons to call exit systematically,
and you would be left with lots of dangling data. For instance, the GC
may trigger the deallocation of X resources; this will not be clean if
the connection to X is lost.

Jacques Garrigue
Bug reports:  FAQ:
To unsubscribe, mail  Archives: