added checks for locking

also assigning the window field to null when quitting the window


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-04-13 20:26:45 +00:00
parent 9a11448fbd
commit 8a9866347d
2 changed files with 33 additions and 28 deletions

View File

@ -463,8 +463,10 @@ KeyboardInputDevice::Stop(const char *name, void *cookie)
wait_for_thread(device->device_watcher, &dummy);
}
if (fTMWindow)
if (fTMWindow) {
fTMWindow->PostMessage(B_QUIT_REQUESTED);
fTMWindow = NULL;
}
return B_OK;
}

View File

@ -48,7 +48,7 @@ TMWindow::TMWindow()
B_ALL_WORKSPACES),
fQuitting(false)
{
Lock();
if (Lock()) {
// ToDo: make this font sensitive
@ -70,6 +70,7 @@ TMWindow::TMWindow()
Unlock();
}
}
TMWindow::~TMWindow()
@ -102,12 +103,15 @@ TMWindow::QuitRequested()
void
TMWindow::Enable()
{
if (Lock()) {
SetPulseRate(1000000);
if (IsHidden()) {
fView->UpdateList();
Show();
}
Unlock();
}
}
@ -198,6 +202,7 @@ TMView::AttachedToWindow()
reboot->SetTarget(this);
fKillButton->SetTarget(this);
fRestartButton->SetTarget(this);
fListView->SetTarget(this);
}
@ -217,7 +222,6 @@ TMView::MessageReceived(BMessage *msg)
break;
}
case TM_RESTART_DESKTOP: {
fRestartButton->SetEnabled(false);
if (!be_roster->IsRunning(kTrackerSignature))
be_roster->Launch(kTrackerSignature);
if (!be_roster->IsRunning(kDeskbarSignature))
@ -302,10 +306,9 @@ TMView::UpdateList()
bool desktopRunning = be_roster->IsRunning(kTrackerSignature)
&& be_roster->IsRunning(kDeskbarSignature);
if (desktopRunning ^ fRestartButton->IsHidden())
if (!desktopRunning && fRestartButton->IsHidden())
fRestartButton->Show();
if (!desktopRunning)
fRestartButton->SetEnabled(true);
fRestartButton->SetEnabled(!desktopRunning);
}