diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/MainWindow.h | 15 | ||||
-rw-r--r-- | src/mainwin.cc | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h index f555906..2c43856 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -157,4 +157,19 @@ public slots: void autoReloadSet(bool); }; +class GuiLocker +{ +public: + GuiLocker() { + gui_locked++; + } + ~GuiLocker() { + gui_locked--; + } + static bool isLocked() { return gui_locked > 0; } + +private: + static unsigned int gui_locked; +}; + #endif diff --git a/src/mainwin.cc b/src/mainwin.cc index 16ad59d..7b69190 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -117,6 +117,9 @@ using CGAL::OGL::Nef3_Converter; #endif #endif // ENABLE_CGAL +// Global application state +unsigned int GuiLocker::gui_locked = 0; + #define QUOTE(x__) # x__ #define QUOTED(x__) QUOTE(x__) @@ -592,6 +595,7 @@ void MainWindow::compile(bool procevents) this->background_chain = NULL; this->root_node = NULL; + this->tree.setRoot(NULL); this->enableOpenCSG = false; // Initialize special variables @@ -1040,6 +1044,9 @@ bool MainWindow::checkModified() void MainWindow::actionReloadCompile() { + if (GuiLocker::isLocked()) return; + GuiLocker lock; + if (!checkModified()) return; console->clear(); @@ -1065,6 +1072,9 @@ void MainWindow::actionReloadCompile() void MainWindow::actionCompile() { + if (GuiLocker::isLocked()) return; + GuiLocker lock; + setCurrentOutput(); console->clear(); @@ -1099,6 +1109,9 @@ void MainWindow::actionCompile() void MainWindow::actionRenderCGAL() { + if (GuiLocker::isLocked()) return; + GuiLocker lock; + setCurrentOutput(); console->clear(); @@ -1273,6 +1286,8 @@ void MainWindow::actionExportSTLorOFF(bool stl_mode) void MainWindow::actionExportSTLorOFF(bool) #endif { + if (GuiLocker::isLocked()) return; + GuiLocker lock; #ifdef ENABLE_CGAL setCurrentOutput(); |