From: SourceForge.net <no...@so...> - 2008-06-30 20:50:35
|
Bugs item #2002364, was opened at 2008-06-25 06:38 Message generated for change (Comment added) made by sds You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=2002364&group_id=1355 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: clx Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Shawn Betts (sabetts) Assigned to: Bruno Haible (haible) Summary: XID reuse causes clx cache to get out of sync Initial Comment: I've isolated a bug in clx that manifests itself in stumpwm as the :window slot in some events coming in as a pixmap instead of a window. The problem stems from X reusing XIDs for drawables (windows and pixmaps) and clx's cache getting out of sync. Here is a function that shows the problem: (defun break-display-xid-cache () (labels ((make-win (dpy) (xlib:create-window :parent (xlib:screen-root (first (xlib:display-roots dpy))) :x 0 :y 0 :width 50 :height 50)) (make-pixmap (window) (xlib:create-pixmap :width (random 100) :height (random 100) :depth 8 :drawable window)) (first-pass (dpy) ;; Open a fresh connection. Create a window and a pixmap. (let* ((dpy2 (xlib:open-default-display)) (window (make-win dpy2)) (pixmap (make-pixmap window))) ;; make the pixmap the window's icon pixmap hint. (setf (xlib:wm-hints window) (xlib:make-wm-hints :icon-pixmap pixmap)) (format t "Window ID: ~s pixmap ID: ~s~%" (xlib:window-id window) (xlib:pixmap-id pixmap)) (xlib:display-finish-output dpy2) ;; On the old connection, list the root window children ;; and the icon pixmap hint to cache their XIDs. (loop for w in (xlib:query-tree (xlib:screen-root (first (xlib:display-roots dpy)))) for hints = (xlib:wm-hints w) when hints do (format t "top level window id: ~s | icon pixmap hint: ~s~%" (xlib:window-id w) (xlib:wm-hints-icon-pixmap hints))) (xlib:close-display dpy2))) (second-pass (dpy) ;; Open a fresh connection and create 2 windows. (let* ((dpy2 (xlib:open-default-display)) (window1 (make-win dpy2)) (window2 (make-win dpy2))) (format t "Window#1 ID: ~s Window#2 ID: ~s~%" (xlib:window-id window1) (xlib:window-id window2)) (xlib:display-finish-output dpy2) ;; On the old connection, list the root window children ;; and note the second window is erroneously a pixmap ;; due to too agressive caching in clx. (loop for w in (xlib:query-tree (xlib:screen-root (first (xlib:display-roots dpy)))) do (format t "window: ~s~%" w)) (xlib:close-display dpy2)))) (let ((dpy (xlib:open-default-display))) (first-pass dpy) (second-pass dpy) (xlib:close-display dpy)))) Note that the last window in the window list is a pixmap! Here's the output I get: [4]> (break-display-xid-cache) Window ID: 20971521 pixmap ID: 20971522 top level window id: 20971521 | icon pixmap hint: #<XLIB:PIXMAP 60x88+0+0 localhost #x01400002 #x20426CAE> Window#1 ID: 20971521 Window#2 ID: 20971522 window: #<XLIB:WINDOW 50x50+0+0 localhost #x01400001 #x20425C8E> window: #<XLIB:PIXMAP 50x50+0+0 localhost #x01400002 #x20426CAE> #<XLIB:DISPLAY XLIB:CLOSED-DISPLAY #x2042478E> [5]> ---------------------------------------------------------------------- >Comment By: Sam Steingold (sds) Date: 2008-06-30 16:50 Message: Logged In: YES user_id=5735 Originator: NO when I modify your code to avoid having two connections open at the same time, the problem disappears. Shawn, are you sure your code is legit? ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2008-06-26 09:56 Message: Logged In: YES user_id=5735 Originator: NO now that I fixed amd64 wm-hints, I see this on all platforms. I think it would be a good idea to check if this is also observable on other lisps and to discuss this on gmane.lisp.clx.devel ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2008-06-25 10:29 Message: Logged In: YES user_id=5735 Originator: NO are you sure that the whole notion of two dpy objects being open simultaneously is valid? I have a feeling that the X people would consider this to be a user program bug. ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2008-06-25 09:48 Message: Logged In: YES user_id=5735 Originator: NO confirm on both mit-clx and new-clx on i386, but NOT on amd64 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=2002364&group_id=1355 |