fix: crash when create project

This commit is contained in:
Roy Qu 2022-10-23 18:39:15 +08:00
parent f348f0782a
commit a42ec4e253
1 changed files with 9 additions and 0 deletions

View File

@ -1138,6 +1138,13 @@ void MainWindow::updateClassBrowserForEditor(Editor *editor)
return; return;
} }
if (editor->inProject() && !mProject) {
//project is in creation
mClassBrowserModel.setCurrentFile(editor->filename());
return;
}
mClassBrowserModel.beginUpdate(); mClassBrowserModel.beginUpdate();
mClassBrowserModel.setParser(editor->parser()); mClassBrowserModel.setParser(editor->parser());
if (editor->inProject()) { if (editor->inProject()) {
@ -6197,6 +6204,8 @@ void MainWindow::on_actionNew_Project_triggered()
mProject->saveAll(); mProject->saveAll();
updateProjectView(); updateProjectView();
scanActiveProject(true); scanActiveProject(true);
Editor* editor = mEditorList->getEditor();
updateClassBrowserForEditor(editor);
} }
pSettings->ui().setNewProjectDialogWidth(dialog.width()); pSettings->ui().setNewProjectDialogWidth(dialog.width());
pSettings->ui().setNewProjectDialogHeight(dialog.height()); pSettings->ui().setNewProjectDialogHeight(dialog.height());