wmaker: fix crash when switching workspace with "Affiche.app"
As reported by Martin Dietze, when switching workspace (mainly with
keyboard shortcut) while the focus was set on a sticky note from the
GNUstep application "Affiche.app" would cause Window Maker to crash.
This crash was due to the application creating its menu with an Omnipresent
state; Window Maker tried to be smart by smartly setting the focus to this
window after the workspace change, unfortunately when removing the window
of the note from the screen the application would decide to remove also the
omnipresent menu (because it is not necessary anymore).
Because we kept a pointer to an outdated WWindow, we would silently corrupt
memory, which would later cause a crash in an unrelated place (fortunately
in this case it happened quite soon).
This patch adds a check to make sure the window we want to focus is still
a valid one, and if it is not we just ignore it to fall back on another
mechanism already in place for picking the window to focus.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>