[mcclim-devel] destroy-port to close connection to broken pipes

Clemens Fruhwirth clemens at endorphin.org
Wed Nov 30 17:18:56 UTC 2005


clim:destroy-port does not succeed in closing an already closed
connection because a stream error is signaled. This might happen after
xkilling an application (the X server terminates the connection) or
network problems. 

Using :abort t for xlib:close-display cuts the connection and there will
be no buffer flushing. My purposed patch is attached. 

Note: SBCL users should put 

(sb-sys:ignore-interrupt sb-unix:sigpipe)

into their .sbclrc. This is necessary because the first attempt to write
to a broken pipe will result in a SIGPIPE, which must be
ignored. Another catchable error (stream-error) is signaled none the
less. Imho sigpipe will becomes ignored per default as discussed on
sbcl-devel recently.
-- 
Fruhwirth Clemens - http://clemens.endorphin.org 
for robots: sp4mtrap at endorphin.org
-------------- next part --------------
Index: Backends/CLX/port.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Backends/CLX/port.lisp,v
retrieving revision 1.114
diff -u -r1.114 port.lisp
--- Backends/CLX/port.lisp	28 Nov 2005 14:21:45 -0000	1.114
+++ Backends/CLX/port.lisp	30 Nov 2005 09:46:04 -0000
@@ -536,7 +536,8 @@
   (xlib:unmap-window (sheet-direct-mirror mirror)) )
 
 (defmethod destroy-port :before ((port clx-port))
-  (xlib:close-display (clx-port-display port)))
+  (handler-case (xlib:close-display (clx-port-display port))
+    (stream-error) () (xlib:close-display (clx-port-display port) :abort t)))
 
 (defmethod port-motion-hints ((port clx-port) (sheet mirrored-sheet-mixin))
   (let ((event-mask (xlib:window-event-mask (sheet-direct-mirror sheet))))


More information about the mcclim-devel mailing list