Crash fix restoring layout.

This commit is contained in:
Leonardo Zide 2020-12-18 11:04:16 -08:00
parent 34d61040f6
commit dcf8ddfd95

View file

@ -1618,9 +1618,9 @@ void lcMainWindow::SetCurrentModelTab(lcModel* Model)
TabWidget->SetModel(Model); TabWidget->SetModel(Model);
NewView = CreateView(Model); NewView = CreateView(Model);
AddView(NewView);
ViewWidget = (lcViewWidget*)TabWidget->layout()->itemAt(0)->widget(); ViewWidget = (lcViewWidget*)TabWidget->layout()->itemAt(0)->widget();
ViewWidget->SetView(NewView); ViewWidget->SetView(NewView);
AddView(NewView);
mModelTabWidget->setCurrentWidget(TabWidget); mModelTabWidget->setCurrentWidget(TabWidget);
} }
@ -1654,8 +1654,6 @@ void lcMainWindow::AddView(View* View)
TabWidget->AddView(View); TabWidget->AddView(View);
View->MakeCurrent();
if (!TabWidget->GetActiveView()) if (!TabWidget->GetActiveView())
{ {
TabWidget->SetActiveView(View); TabWidget->SetActiveView(View);