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