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

a pesky bug



Laura Bagnall, here at TERC, has tracked down
another annoying bug down in the innards of
MCL 2.0(p3).  Any of you that have been using
windoids may want to take a look at this

There is a bug with windoids in which *windoid-count*
isn't properly maintained.  Specifically, if you create
a windoid in which there are no other windoids, hide it,
then show it again, then *windoid-count* is 2 instead
of 1 (see transcript below).  This is a problem because
(window-show <window>) seems to do a (set-window-layer 
*windoid-count*) which will then put the window in the
wrong layer.  I defined an :after method for window-show
which works around the problem and seems to make everything
behave correctly (again see transcript), but I'm sure that
there'd be a better fix if one had the source.

? *windoid-count*  ; no windoids around
0
? (setf test (make-instance 'windoid))
#<WINDOID "Untitled" #x6698D9>
? *windoid-count*  ; we've just created and shown one windoid.
1
? (window-hide test)
0
? *windoid-count*  ; no windoids visible.
0
? (window-show test)
2
? *windoid-count*  ;Whoops!  Only one visible windoid, but count is 2!
2
? (window-hide test)
1
? *windoid-count* ;no visible windoids, but count is 1.
1
? (windows :class 'windoid) ;just to confirm that there
			    ;are no visible windoids.
NIL
? (setf *windoid-count* 0)  ;set *windoid-count* to be the correct value again.
0
? (defmethod window-show :after ((w windoid))  ;define patch to work
					       ;around the bug.
     (setf *windoid-count* (length (windows :class 'windoid))))
#<STANDARD-METHOD WINDOW-SHOW :AFTER (WINDOID)>
? (setf test2 (make-instance 'windoid))  ;make another windoid
#<WINDOID "Untitled" #x681A31>
? *windoid-count*  ;one windoid is visible.
1
? (window-hide test2)  ;no windoids are visible.
0
? *windoid-count*
0
? (window-show test2)  ;one windoid is visible.
2
? *windoid-count*  ;and *windoid-count* now reflects this.
1
? 


Blake Meike
TERC
2067 Mass. Ave.
Cambridge, MA  02140