Don't crash the app server if the user calls BScreen(BWindow *) supplying

an offscreen window (Magnify does that, and that's the cause of ticket #4304).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32611 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2009-08-22 14:14:17 +00:00
parent a078b74cab
commit f277acc9cd
3 changed files with 14 additions and 1 deletions

View File

@ -2264,9 +2264,11 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for (int32 i = fWindowList.CountItems(); i-- > 0;) { for (int32 i = fWindowList.CountItems(); i-- > 0;) {
ServerWindow* window = fWindowList.ItemAt(i); ServerWindow* window = fWindowList.ItemAt(i);
if (window->ClientToken() == clientToken) { if (window->ClientToken() == clientToken) {
// found it! // found it!
if (window->IsOffscreen())
break;
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<int32>(window->Window()->Screen()->ID()); fLink.Attach<int32>(window->Window()->Screen()->ID());
status = B_OK; status = B_OK;

View File

@ -671,6 +671,16 @@ ServerWindow::Window() const
} }
bool
ServerWindow::IsOffscreen() const
{
// TODO: ensure desktop is locked!
// TODO: ensure the Window has been created!
return fWindow->IsOffscreenWindow();
}
View* View*
ServerWindow::_CreateView(BPrivate::LinkReceiver& link, View** _parent) ServerWindow::_CreateView(BPrivate::LinkReceiver& link, View** _parent)
{ {

View File

@ -84,6 +84,7 @@ public:
inline ServerApp* App() const { return fServerApp; } inline ServerApp* App() const { return fServerApp; }
::Desktop* Desktop() const { return fDesktop; } ::Desktop* Desktop() const { return fDesktop; }
::Window* Window() const; ::Window* Window() const;
bool IsOffscreen() const;
void SetTitle(const char* newTitle); void SetTitle(const char* newTitle);
inline const char* Title() const { return fTitle; } inline const char* Title() const { return fTitle; }