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); wait_for_thread(device->device_watcher, &dummy);
} }
if (fTMWindow) if (fTMWindow) {
fTMWindow->PostMessage(B_QUIT_REQUESTED); fTMWindow->PostMessage(B_QUIT_REQUESTED);
fTMWindow = NULL;
}
return B_OK; return B_OK;
} }

View File

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