Fixed a couple of crashes. app_server nicely quits now.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11564 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-03-03 23:21:36 +00:00
parent 9b3fd9f88c
commit 74d5a8f70e
3 changed files with 22 additions and 24 deletions

View File

@ -215,7 +215,7 @@ int32 AppServer::PicassoThread(void *data)
}
release_sem(appserver->fAppListLock);
// we do this every other second so as not to suck *too* many CPU cycles
snooze(2000000);
snooze(1000000);
}
return 0;
}
@ -271,12 +271,6 @@ void AppServer::MainLoop(void)
break;
}
}
if(code==AS_DELETE_APP || (code==B_QUIT_REQUESTED && DISPLAYDRIVER!=HWDRIVER))
{
if(fQuittingServer== true && fAppList->CountItems()== 0)
break;
}
}
}
@ -653,7 +647,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
for(int32 j=0; j<5; j++)
{
snooze(1000); // wait half a second for it to quit
snooze(500000); // wait half a second for it to quit
if(get_thread_info(app->fMonitorThreadID, &tinfo)!=B_OK)
{
killteam=false;
@ -668,10 +662,15 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
}
}
}
kill_thread(fPicassoThreadID);
release_sem(fAppListLock);
delete desktop;
// When we delete the last ServerApp, we can exit the server
fQuittingServer=true;
exit_thread(0);
// we are now clear to exit
break;

View File

@ -1482,7 +1482,7 @@ void RootLayer::hide_winBorder(WinBorder *winBorder)
bool invalidate = false;
bool invalid;
winBorder->Show(false);
winBorder->Hide(false);
for (int32 i = 0; i < fWsCount; i++)
{

View File

@ -292,10 +292,7 @@ void ServerWindow::Hide(void)
*/
bool ServerWindow::IsHidden(void) const
{
if(fWinBorder)
return fWinBorder->IsHidden();
return true;
}
//------------------------------------------------------------------------------
void ServerWindow::Minimize(bool status)
@ -2221,24 +2218,26 @@ int32 ServerWindow::MonitorWin(void *data)
{
// this means the client has been killed
STRACE(("ServerWindow %s received 'AS_CLIENT_DEAD/AS_DELETE_WINDOW' message code\n",win->Title()));
RootLayer *myRootLayer = win->fWinBorder->GetRootLayer();
// RootLayer *myRootLayer = win->fWinBorder->GetRootLayer();
quitting = true;
// quitting = true;
// we are preparing to delete a ServerWindow, RootLayer should be aware
// of that and stop for a moment.
// also we must wait a bit for the associated WinBorder to become hidden
while(1)
{
myRootLayer->Lock();
if (win->IsHidden())
break;
else
myRootLayer->Unlock();
}
// while(1)
// {
// myRootLayer->Lock();
// if (win->IsHidden())
// break;
// else
// myRootLayer->Unlock();
// }
// ServerWindow's destructor takes care of pulling this object off the desktop.
if (!win->IsHidden())
debugger("ServerWindow: a window must be hidden before it's deleted\n");
delete win;
myRootLayer->Unlock();
// myRootLayer->Unlock();
exit_thread(0);
break;