Tracker: Fix crash when the VirtualDirectoryWindow can't create the PoseView.

Fixes #11859. We may want to show an error message rather than failing
silently, but at least that is better than crashing.
This commit is contained in:
Augustin Cavalier
2015-08-03 11:32:15 -04:00
parent c2e9a9227e
commit a4db376caa
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -1200,7 +1200,7 @@ BContainerWindow::SaveState(BMessage& message) const
bool
BContainerWindow::StateNeedsSaving() const
{
return fStateNeedsSaving || PoseView()->StateNeedsSaving();
return fPoseView != NULL && (fStateNeedsSaving || fPoseView->StateNeedsSaving());
}
+6
View File
@@ -1113,6 +1113,12 @@ TTracker::OpenContainerWindow(Model* model, BMessage* originalRefsList,
if (model != NULL && window->LockLooper()) {
window->CreatePoseView(model);
if (window->PoseView() == NULL) {
// Failed initialization.
window->PostMessage(B_QUIT_REQUESTED);
window->UnlockLooper();
return;
}
window->UnlockLooper();
}
@@ -76,6 +76,8 @@ void
VirtualDirectoryWindow::CreatePoseView(Model* model)
{
fPoseView = NewPoseView(model, kListMode);
if (fPoseView == NULL)
return;
fBorderedView->GroupLayout()->AddView(fPoseView);
fBorderedView->EnableBorderHighlight(false);