From 9e1a0720cb3f2e15944658003beac1db18bf5c09 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 11 May 2013 07:29:34 +0200 Subject: [PATCH] Fix FFM focus loss on window close kFocusList is an invalid index for _Windows(). fWorkspaces would be accessed out of bounds. --- src/servers/app/Desktop.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 4663c0b9e3..f9e8d4553c 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1903,12 +1903,15 @@ Desktop::SetFocusWindow(Window* nextFocus) return; } - uint32 list = fCurrentWorkspace; - if (!fSettings->NormalMouse()) - list = kFocusList; + uint32 listIndex = fCurrentWorkspace; + WindowList* list = &_Windows(fCurrentWorkspace); + if (!fSettings->NormalMouse()) { + listIndex = kFocusList; + list = &fFocusList; + } if (nextFocus == NULL || hasModal || hasWindowScreen) { - nextFocus = _Windows(list).LastWindow(); + nextFocus = list->LastWindow(); if (fSettings->NormalMouse()) { // If the last window having focus is a window that cannot make it @@ -1923,7 +1926,7 @@ Desktop::SetFocusWindow(Window* nextFocus) // make sure no window is chosen that doesn't want focus or cannot have it while (nextFocus != NULL && !_WindowCanHaveFocus(nextFocus)) { - nextFocus = nextFocus->PreviousWindow(list); + nextFocus = nextFocus->PreviousWindow(listIndex); } if (fFocus == nextFocus) {