- enhancement: Waiting for syntax parsers to finish before saving files, to prevent data lost caused by syntax parsering crash.
This commit is contained in:
parent
375e990e0b
commit
562293c05d
1
NEWS.md
1
NEWS.md
|
@ -10,6 +10,7 @@ Red Panda C++ Version 2.8
|
||||||
- enhancement: "Switch Header/Source" in editor title bar context menu.
|
- enhancement: "Switch Header/Source" in editor title bar context menu.
|
||||||
- enhancement: "Toggle readonly" in the Edit menu.
|
- enhancement: "Toggle readonly" in the Edit menu.
|
||||||
- fix: Error When save project units' encoding settings.
|
- fix: Error When save project units' encoding settings.
|
||||||
|
- enhancement: Waiting for syntax parsers to finish before saving files, to prevent data lost caused by syntax parsering crash.
|
||||||
|
|
||||||
Red Panda C++ Version 2.7
|
Red Panda C++ Version 2.7
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,9 @@ bool Editor::save(bool force, bool doReparse) {
|
||||||
if (this->mIsNew && !force) {
|
if (this->mIsNew && !force) {
|
||||||
return saveAs();
|
return saveAs();
|
||||||
}
|
}
|
||||||
|
while (pMainWindow->parsing()) {
|
||||||
|
QThread::msleep(200);
|
||||||
|
}
|
||||||
//is this file writable;
|
//is this file writable;
|
||||||
pMainWindow->fileSystemWatcher()->removePath(mFilename);
|
pMainWindow->fileSystemWatcher()->removePath(mFilename);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -519,6 +519,9 @@ void MainWindow::updateEditorActions()
|
||||||
|
|
||||||
void MainWindow::updateEditorActions(const Editor *e)
|
void MainWindow::updateEditorActions(const Editor *e)
|
||||||
{
|
{
|
||||||
|
//it's not a compile action, but put here for convinience
|
||||||
|
ui->actionSaveAll->setEnabled(
|
||||||
|
(mProject!=nullptr || mEditorList->pageCount()>0));
|
||||||
if (e==nullptr) {
|
if (e==nullptr) {
|
||||||
ui->actionAuto_Detect->setEnabled(false);
|
ui->actionAuto_Detect->setEnabled(false);
|
||||||
ui->actionEncode_in_ANSI->setEnabled(false);
|
ui->actionEncode_in_ANSI->setEnabled(false);
|
||||||
|
@ -659,7 +662,9 @@ void MainWindow::updateCompileActions() {
|
||||||
|
|
||||||
void MainWindow::updateCompileActions(const Editor *e)
|
void MainWindow::updateCompileActions(const Editor *e)
|
||||||
{
|
{
|
||||||
if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing()) {
|
if (mCompilerManager->compiling()
|
||||||
|
//|| mCompilerManager->backgroundSyntaxChecking()
|
||||||
|
|| mCompilerManager->running() || mDebugger->executing()) {
|
||||||
ui->actionCompile->setEnabled(false);
|
ui->actionCompile->setEnabled(false);
|
||||||
ui->actionCompile_Run->setEnabled(false);
|
ui->actionCompile_Run->setEnabled(false);
|
||||||
ui->actionRun->setEnabled(false);
|
ui->actionRun->setEnabled(false);
|
||||||
|
@ -712,9 +717,7 @@ void MainWindow::updateCompileActions(const Editor *e)
|
||||||
}
|
}
|
||||||
ui->actionStop_Execution->setEnabled(mCompilerManager->running() || mDebugger->executing());
|
ui->actionStop_Execution->setEnabled(mCompilerManager->running() || mDebugger->executing());
|
||||||
|
|
||||||
//it's not a compile action, but put here for convinience
|
|
||||||
ui->actionSaveAll->setEnabled(mProject!=nullptr
|
|
||||||
|| mEditorList->pageCount()>0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateEditorColorSchemes()
|
void MainWindow::updateEditorColorSchemes()
|
||||||
|
@ -1850,6 +1853,24 @@ void MainWindow::checkSyntaxInBack(Editor *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::compiling()
|
||||||
|
{
|
||||||
|
return (mCompilerManager->backgroundSyntaxChecking()) || (mCompilerManager->compiling());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::parsing()
|
||||||
|
{
|
||||||
|
if (mProject && mProject->cppParser() && mProject->cppParser()->parsing())
|
||||||
|
return true;
|
||||||
|
for(int i=0;i<mEditorList->pageCount();i++) {
|
||||||
|
Editor * editor = (*mEditorList)[i];
|
||||||
|
if (editor->parser() && editor->parser()->parsing())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
||||||
{
|
{
|
||||||
mCompilerManager->stopPausing();
|
mCompilerManager->stopPausing();
|
||||||
|
|
|
@ -131,6 +131,8 @@ public:
|
||||||
void updateDebuggerSettings();
|
void updateDebuggerSettings();
|
||||||
void updateActionIcons();
|
void updateActionIcons();
|
||||||
void checkSyntaxInBack(Editor* e);
|
void checkSyntaxInBack(Editor* e);
|
||||||
|
bool compiling();
|
||||||
|
bool parsing();
|
||||||
bool compile(bool rebuild=false, CppCompileType compileType=CppCompileType::Normal);
|
bool compile(bool rebuild=false, CppCompileType compileType=CppCompileType::Normal);
|
||||||
void runExecutable(
|
void runExecutable(
|
||||||
const QString& exeName,
|
const QString& exeName,
|
||||||
|
|
Loading…
Reference in New Issue