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:
@@ -761,35 +761,30 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
|||||||
Broadcast(AS_QUIT_APP);
|
Broadcast(AS_QUIT_APP);
|
||||||
|
|
||||||
// we have to wait until *all* threads have finished!
|
// we have to wait until *all* threads have finished!
|
||||||
ServerApp *app= NULL;
|
ServerApp *app;
|
||||||
acquire_sem(fAppListLock);
|
acquire_sem(fAppListLock);
|
||||||
thread_info tinfo;
|
thread_info tinfo;
|
||||||
for(int32 i= 0; i < fAppList->CountItems(); i++)
|
for (int32 i = 0; i < fAppList->CountItems(); i++) {
|
||||||
{
|
app = (ServerApp*)fAppList->ItemAt(i);
|
||||||
app=(ServerApp*)fAppList->ItemAt(i);
|
if (!app)
|
||||||
if(!app)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Instead of calling wait_for_thread, we will wait a bit, check for the
|
// 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
|
// 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
|
// or hung. Seeing that being the case, we'll kill its BApp team and fake the
|
||||||
// quit message
|
// quit message
|
||||||
if(get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK)
|
if (get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK) {
|
||||||
{
|
bool killteam = true;
|
||||||
bool killteam=true;
|
|
||||||
|
|
||||||
for(int32 j=0; j<5; j++)
|
for (int32 j = 0; j < 5; j++) {
|
||||||
{
|
|
||||||
snooze(500000); // wait half a second for it to quit
|
snooze(500000); // wait half a second for it to quit
|
||||||
if(get_thread_info(app->MonitorThreadID(), &tinfo)!=B_OK)
|
if (get_thread_info(app->MonitorThreadID(), &tinfo) != B_OK) {
|
||||||
{
|
killteam = false;
|
||||||
killteam=false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(killteam)
|
if (killteam) {
|
||||||
{
|
|
||||||
kill_team(app->ClientTeamID());
|
kill_team(app->ClientTeamID());
|
||||||
app->PostMessage(B_QUIT_REQUESTED);
|
app->PostMessage(B_QUIT_REQUESTED);
|
||||||
}
|
}
|
||||||
@@ -804,11 +799,9 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
|||||||
delete fAppList;
|
delete fAppList;
|
||||||
delete bitmapmanager;
|
delete bitmapmanager;
|
||||||
delete fontserver;
|
delete fontserver;
|
||||||
make_decorator=NULL;
|
|
||||||
|
|
||||||
exit_thread(0);
|
|
||||||
|
|
||||||
// we are now clear to exit
|
// we are now clear to exit
|
||||||
|
exit_thread(0);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,8 +102,10 @@ void
|
|||||||
Desktop::AddDriver(DisplayDriver *driver)
|
Desktop::AddDriver(DisplayDriver *driver)
|
||||||
{
|
{
|
||||||
if (driver->Initialize()) {
|
if (driver->Initialize()) {
|
||||||
// TODO: be careful of screen initialization - monitor may not support 640x480
|
|
||||||
Screen *screen = new Screen(driver, fScreenList.CountItems() + 1);
|
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);
|
screen->SetMode(640, 480, B_RGB32, 60.f);
|
||||||
|
|
||||||
fScreenList.AddItem(screen);
|
fScreenList.AddItem(screen);
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ Screen::Screen(DisplayDriver *driver, int32 id)
|
|||||||
|
|
||||||
Screen::~Screen(void)
|
Screen::~Screen(void)
|
||||||
{
|
{
|
||||||
//printf("~Screen( %ld )\n", fID);
|
delete fDriver;
|
||||||
// TODO: Who is supposed to delete the display driver? It's ours, no?
|
|
||||||
// delete fDDriver;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user