bonefish + axeld:

* When moving a window to another workspace (using the mouse or the keyboard),
  the fLastWorkspaceFocus array of the old workspace could still point to that
  window.
* This could also lead to a stale pointer and might have caused crashes in
  SetFocusWindow(). This should fix #5124, and its duplicates #5294, and #5688.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36165 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-04-11 19:12:39 +00:00
parent f440034d88
commit b6486ac2c0
+7 -3
View File
@@ -179,7 +179,7 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
{
STRACE(("Set Workspace %ld\n", key - 1));
fDesktop->SetWorkspaceAsync(key - 2,
fDesktop->SetWorkspaceAsync(key - B_F1_KEY,
(modifiers & B_SHIFT_KEY) != 0);
return B_SKIP_MESSAGE;
}
@@ -1620,7 +1620,8 @@ Desktop::KeyboardEventTarget()
/*! Tries to set the focus to the specified \a focus window. It will make sure,
however, that the window actually can have focus.
however, that the window actually can have focus. You are allowed to pass
in a NULL pointer for \a focus.
Besides the B_AVOID_FOCUS flag, a modal window, or a BWindowScreen can both
prevent it from getting focus.
@@ -3119,7 +3120,10 @@ Desktop::_SetWorkspace(int32 index, bool moveFocusWindow)
movedWindow->Anchor(index).position = movedWindow->Frame().LeftTop();
}
fLastWorkspaceFocus[previousIndex] = FocusWindow();
if (movedWindow == NULL || movedWindow->InWorkspace(previousIndex))
fLastWorkspaceFocus[previousIndex] = FocusWindow();
else
fLastWorkspaceFocus[previousIndex] = NULL;
// build region of windows that are no longer visible in the new workspace