]> code.delx.au - spectrwm/commit
Fix a crash when mvws_n is used in an empty workspace.
authorLawrence Teo <lteo@lteo.net>
Tue, 10 Jan 2012 01:30:00 +0000 (20:30 -0500)
committerLawrence Teo <lteo@lteo.net>
Tue, 10 Jan 2012 01:45:49 +0000 (20:45 -0500)
commitc9ca43ac665ec0473a0671e15f55837befa21078
tree415c1279f19eecbbe638c89052d3a4a507bb3040
parent2288fb796177fd8643f563e1e150f7a4cd477077
Fix a crash when mvws_n is used in an empty workspace.

mvws_n invokes send_to_ws(), which in turn calls focus() to focus on
the previous window before sending the current window to the desired
workspace. The TAILQ_PREV() call in focus() will fail if there are no
windows in the current workspace.

This commit adds a safeguard to focus() by ensuring that the list of
windows in the current workspace is not empty and that there is at
least one uniconified window to focus on before proceeding.

This commit also modifies send_to_ws() to set r->ws->focus to NULL if
there are no more windows in the workspace after sending the current
window to another workspace. This fixes an odd behavior where you can
"summon" a window that you have previously moved to another workspace,
even though you are in an empty workspace.

Closes FS#191

ok marco
scrotwm.c