Fixed the crashing bug when quitting the app_server.
The display driver is now owned by the Screen object. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13002 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d673482488
commit
0aa69a9cd4
@ -761,35 +761,30 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
Broadcast(AS_QUIT_APP);
|
||||
|
||||
// we have to wait until *all* threads have finished!
|
||||
ServerApp *app= NULL;
|
||||
ServerApp *app;
|
||||
acquire_sem(fAppListLock);
|
||||
thread_info tinfo;
|
||||
for(int32 i= 0; i < fAppList->CountItems(); i++)
|
||||
{
|
||||
app=(ServerApp*)fAppList->ItemAt(i);
|
||||
if(!app)
|
||||
for (int32 i = 0; i < fAppList->CountItems(); i++) {
|
||||
app = (ServerApp*)fAppList->ItemAt(i);
|
||||
if (!app)
|
||||
continue;
|
||||
|
||||
|
||||
// Instead of calling wait_for_thread, we will wait a bit, check for the
|
||||
// thread_id. We will only wait so long, because then the app is probably crashed
|
||||
// or hung. Seeing that being the case, we'll kill its BApp team and fake the
|
||||
// quit message
|
||||
if(get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK)
|
||||
{
|
||||
bool killteam=true;
|
||||
|
||||
for(int32 j=0; j<5; j++)
|
||||
{
|
||||
if (get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK) {
|
||||
bool killteam = true;
|
||||
|
||||
for (int32 j = 0; j < 5; j++) {
|
||||
snooze(500000); // wait half a second for it to quit
|
||||
if(get_thread_info(app->MonitorThreadID(), &tinfo)!=B_OK)
|
||||
{
|
||||
killteam=false;
|
||||
if (get_thread_info(app->MonitorThreadID(), &tinfo) != B_OK) {
|
||||
killteam = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(killteam)
|
||||
{
|
||||
|
||||
if (killteam) {
|
||||
kill_team(app->ClientTeamID());
|
||||
app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
@ -804,11 +799,9 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
delete fAppList;
|
||||
delete bitmapmanager;
|
||||
delete fontserver;
|
||||
make_decorator=NULL;
|
||||
|
||||
exit_thread(0);
|
||||
|
||||
// we are now clear to exit
|
||||
exit_thread(0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -102,8 +102,10 @@ void
|
||||
Desktop::AddDriver(DisplayDriver *driver)
|
||||
{
|
||||
if (driver->Initialize()) {
|
||||
// TODO: be careful of screen initialization - monitor may not support 640x480
|
||||
Screen *screen = new Screen(driver, fScreenList.CountItems() + 1);
|
||||
// The driver is now owned by the screen
|
||||
|
||||
// TODO: be careful of screen initialization - monitor may not support 640x480
|
||||
screen->SetMode(640, 480, B_RGB32, 60.f);
|
||||
|
||||
fScreenList.AddItem(screen);
|
||||
|
@ -48,9 +48,7 @@ Screen::Screen(DisplayDriver *driver, int32 id)
|
||||
|
||||
Screen::~Screen(void)
|
||||
{
|
||||
//printf("~Screen( %ld )\n", fID);
|
||||
// TODO: Who is supposed to delete the display driver? It's ours, no?
|
||||
// delete fDDriver;
|
||||
delete fDriver;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user