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:
@@ -1200,7 +1200,7 @@ BContainerWindow::SaveState(BMessage& message) const
|
|||||||
bool
|
bool
|
||||||
BContainerWindow::StateNeedsSaving() const
|
BContainerWindow::StateNeedsSaving() const
|
||||||
{
|
{
|
||||||
return fStateNeedsSaving || PoseView()->StateNeedsSaving();
|
return fPoseView != NULL && (fStateNeedsSaving || fPoseView->StateNeedsSaving());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1113,6 +1113,12 @@ TTracker::OpenContainerWindow(Model* model, BMessage* originalRefsList,
|
|||||||
|
|
||||||
if (model != NULL && window->LockLooper()) {
|
if (model != NULL && window->LockLooper()) {
|
||||||
window->CreatePoseView(model);
|
window->CreatePoseView(model);
|
||||||
|
if (window->PoseView() == NULL) {
|
||||||
|
// Failed initialization.
|
||||||
|
window->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
window->UnlockLooper();
|
||||||
|
return;
|
||||||
|
}
|
||||||
window->UnlockLooper();
|
window->UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ void
|
|||||||
VirtualDirectoryWindow::CreatePoseView(Model* model)
|
VirtualDirectoryWindow::CreatePoseView(Model* model)
|
||||||
{
|
{
|
||||||
fPoseView = NewPoseView(model, kListMode);
|
fPoseView = NewPoseView(model, kListMode);
|
||||||
|
if (fPoseView == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
fBorderedView->GroupLayout()->AddView(fPoseView);
|
fBorderedView->GroupLayout()->AddView(fPoseView);
|
||||||
fBorderedView->EnableBorderHighlight(false);
|
fBorderedView->EnableBorderHighlight(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user