When a focus locked window is hidden, we need to remove the focus lock.

Otherwise the focus cannot be changed to another window. In one case this could
have a severe sideeffect: When a window is quit it is hidden to remove focus and
remove it from screen. If this didn't work due to the focus lock, the fFocus
member would become a stale pointer after the window was quit and deleted. The
app_server would crash or corrupt memory on the next focus change. Easily seen
when moderately quickly clicking away a few alert windows.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32929 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-09-04 03:51:15 +00:00
parent ccc2cf7f03
commit 60a981fbbe
1 changed files with 8 additions and 3 deletions

View File

@ -1065,16 +1065,21 @@ Desktop::HideWindow(Window* window)
fMouseEventWindow = NULL;
}
if (fLockedFocusWindow == window) {
// Remove the focus lock so the focus can be changed below
fLockedFocusWindow = NULL;
}
if (window->InWorkspace(fCurrentWorkspace)) {
_UpdateSubsetWorkspaces(window);
_HideWindow(window);
_UpdateFronts();
if (FocusWindow() == window)
SetFocusWindow();
} else
_WindowChanged(window);
if (FocusWindow() == window)
SetFocusWindow();
_WindowRemoved(window);
if (window->HasWorkspacesViews()) {