* Added an ASSERT() and a check to make sure the workspace that Backmost() and

Frontmost() are using is valid.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28228 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-18 11:59:02 +00:00
parent 9aabc02b4c
commit 0f32f7ddeb
+14
View File
@@ -1436,6 +1436,9 @@ Window::HasModal() const
/*! \brief Returns the windows that's in behind of the backmost position /*! \brief Returns the windows that's in behind of the backmost position
this window can get. this window can get.
Returns NULL is this window can be the backmost window. Returns NULL is this window can be the backmost window.
\param workspace the workspace on which this check should be made. If
the value is -1, the window's current workspace will be used.
*/ */
Window* Window*
Window::Backmost(Window* window, int32 workspace) Window::Backmost(Window* window, int32 workspace)
@@ -1443,6 +1446,10 @@ Window::Backmost(Window* window, int32 workspace)
if (workspace == -1) if (workspace == -1)
workspace = fCurrentWorkspace; workspace = fCurrentWorkspace;
ASSERT(workspace != -1);
if (workspace == -1)
return NULL;
// Desktop windows are always backmost // Desktop windows are always backmost
if (fFeel == kDesktopWindowFeel) if (fFeel == kDesktopWindowFeel)
return NULL; return NULL;
@@ -1465,6 +1472,9 @@ Window::Backmost(Window* window, int32 workspace)
/*! \brief Returns the windows that's in front of the frontmost position /*! \brief Returns the windows that's in front of the frontmost position
this window can get. this window can get.
Returns NULL if this window can be the frontmost window. Returns NULL if this window can be the frontmost window.
\param workspace the workspace on which this check should be made. If
the value is -1, the window's current workspace will be used.
*/ */
Window* Window*
Window::Frontmost(Window* first, int32 workspace) Window::Frontmost(Window* first, int32 workspace)
@@ -1472,6 +1482,10 @@ Window::Frontmost(Window* first, int32 workspace)
if (workspace == -1) if (workspace == -1)
workspace = fCurrentWorkspace; workspace = fCurrentWorkspace;
ASSERT(workspace != -1);
if (workspace == -1)
return NULL;
if (fFeel == kDesktopWindowFeel) if (fFeel == kDesktopWindowFeel)
return first ? first : NextWindow(workspace); return first ? first : NextWindow(workspace);