stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] [PATCH] Fix remove-head bug.


From: John Li
Subject: [STUMP] [PATCH] Fix remove-head bug.
Date: Sat, 26 Jul 2008 06:06:25 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

remove-head tried to reference part of the frame-tree (through
toggle-mode-line) after it was previously removed.
---

remove-head -> toggle-mode-line -> sync-head-frame-windows ->
  head-frames -> tile-group-frame-head -> boom.

Backtrace here: http://paste.lisp.org/display/64248

This would happen (I believe) every single time I would remove my
external display from my laptop by calling "xrandr --output VGA
--off". Now, toggle the mode-line /before/ removing a chunk of the
frame-tree.

 screen.lisp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/screen.lisp b/screen.lisp
index 6192406..5701b63 100644
--- a/screen.lisp
+++ b/screen.lisp
@@ -564,30 +564,30 @@ FOCUS-WINDOW is an extra window used for 
_NET_SUPPORTING_WM_CHECK."
     (let ((frame (tile-group-frame-head group head)))
       (choose-new-frame-window frame group)
       (when (frame-window frame)
         (unhide-window (frame-window frame))))))
 
 (defun remove-head (screen head)
   (dformat 1 "Removing head #~D~%" (head-number head))
+  (when (head-mode-line head)
+    (toggle-mode-line screen head))
   (dolist (group (screen-groups screen))
     ;; Hide its windows.
     (let ((windows (head-windows group head)))
       ;; Remove it from the frame tree.
       (setf (tile-group-frame-tree group) (delete (tile-group-frame-head group 
head) (tile-group-frame-tree group)))
       ;; Just set current frame to whatever.
       (let ((frame (first (group-frames group))))
         (setf (tile-group-current-frame group) frame
               (tile-group-last-frame group) nil)
         (dolist (window windows)
           (hide-window window)
           (setf (window-frame window) frame))))
     ;; Try to do something with the orphaned windows
     (populate-frames group))
-  (when (head-mode-line head)
-    (toggle-mode-line screen head))
   ;; Remove it from SCREEN's head list.
   (setf (screen-heads screen) (delete head (screen-heads screen))))
 
 (defun scale-head (screen oh nh)
   "Scales head OH to match the dimensions of NH."
   (dolist (group (screen-groups screen))
     (resize-tree (tile-group-frame-head group oh) (head-width nh) (head-height 
nh) (head-x nh) (head-y nh)))
-- 
1.5.6.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]