diff --git a/NEWS.md b/NEWS.md index ff7a17a1..4eb01522 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,6 +26,7 @@ Red Panda C++ Version 2.24 - fix: When opening multiple files, only the active file should be parsed. - fix: Wrong compiler settings if xcode is not installed in mac os. - enhancement: Name for new files will not be different from files openned. + - fix: Crash if close file while auto syntax checking. Red Panda C++ Version 2.23 diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index ea256097..770cefef 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -323,7 +323,7 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding,FileType fileTyp // test if force utf8 from autolink infos if ((fileType == FileType::CSource || fileType == FileType::CppSource) && pSettings->editor().enableAutolink() ){ - Editor* editor = pMainWindow->editorList()->getEditor(); + Editor* editor = pMainWindow->editorList()->getOpenedEditorByFilename(mFilename); if (editor) { PCppParser parser = editor->parser(); if (parser) { @@ -340,7 +340,7 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding,FileType fileTyp } QSet parsedFiles; forceExecUTF8 = parseForceUTF8ForAutolink( - editor->filename(), + mFilename, parsedFiles, parser); } diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 4da3faec..ae79c467 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -192,6 +192,7 @@ Editor::Editor(QWidget *parent, const QString& filename, mStatementColors = pMainWindow->statementColors(); if (mParentPageControl) { + //first showEvent triggered here mParentPageControl->addTab(this,""); updateCaption(); } @@ -217,12 +218,13 @@ Editor::Editor(QWidget *parent, const QString& filename, this, &Editor::onScrollBarValueChanged); mInited=true; -// if (!pMainWindow->openingFiles() -// && !pMainWindow->openingProject()) { -// reparse(false); -// checkSyntaxInBack(); -// reparseTodo(); -// } + //show event is trigged when this is added to the qtabwidget + if (!pMainWindow->openingFiles() + && !pMainWindow->openingProject()) { + reparse(false); + checkSyntaxInBack(); + reparseTodo(); + } } Editor::~Editor() { @@ -3106,7 +3108,7 @@ void Editor::reparse(bool resetParser) return; if (!mParser->enabled()) return; - + //qDebug()<<"reparse "<setEnabled(pSettings->codeCompletion().enabled()); ParserLanguage language = mUseCppSyntax?ParserLanguage::CPlusPlus:ParserLanguage::C; if (!inProject()) { diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 33adb253..f15b0223 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -66,6 +66,7 @@ CppParser::CppParser(QObject *parent) : QObject(parent) CppParser::~CppParser() { + //qDebug()<<"delete parser"; while (true) { //wait for all methods finishes running { @@ -75,6 +76,7 @@ CppParser::~CppParser() break; } } + //qDebug()<<"waiting for parse finished"; QThread::msleep(50); QCoreApplication* app = QApplication::instance(); app->processEvents();