- fix: Crash if close file while auto syntax checking.

This commit is contained in:
Roy Qu 2023-08-12 13:51:35 +08:00
parent 496421e97d
commit f462d6708d
4 changed files with 14 additions and 9 deletions

View File

@ -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

View File

@ -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<QString> parsedFiles;
forceExecUTF8 = parseForceUTF8ForAutolink(
editor->filename(),
mFilename,
parsedFiles,
parser);
}

View File

@ -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 "<<mFilename;
//mParser->setEnabled(pSettings->codeCompletion().enabled());
ParserLanguage language = mUseCppSyntax?ParserLanguage::CPlusPlus:ParserLanguage::C;
if (!inProject()) {

View File

@ -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();