diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 2b91f88ca..d3c1bbff8 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -29,7 +29,8 @@ using namespace rtengine::procparams; -EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), beforeIarea(NULL), parent(NULL), beforeIpc(NULL), ipc(NULL), catalogPane(NULL) { +EditorPanel::EditorPanel (FilePanel* filePanel) + : beforePreviewHandler(NULL), beforeIarea(NULL), parent(NULL), beforeIpc(NULL), ipc(NULL), catalogPane(NULL), isProcessing(false) { epih = new EditorPanelIdleHelper; epih->epanel = this; @@ -365,6 +366,9 @@ void EditorPanel::on_realize () { void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { close(); + + isProcessing=true; // prevents closing-on-init + // initialize everything openThm = tmb; openThm->increaseRef (); @@ -575,12 +579,12 @@ void EditorPanel::setProgressStr (Glib::ustring str) } // This is only called from the ThreadUI, so within the gtk thread -void EditorPanel::refreshProcessingState (bool inProcessing) { +void EditorPanel::refreshProcessingState (bool inProcessingP) { spparams *s=new spparams; s->pProgress = progressLabel; s->gtkEnter = false; - if (inProcessing) { + if (inProcessingP) { if (processingStartedTime==0) processingStartedTime = ::time(NULL); s->str = "PROGRESSBAR_PROCESSING"; @@ -607,6 +611,8 @@ void EditorPanel::refreshProcessingState (bool inProcessing) { s->val = 1.0; } + isProcessing=inProcessingP; + _setprogressStr(s); } diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index ada625ca0..6dc722871 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -118,6 +118,9 @@ class EditorPanel : public Gtk::VBox, sigc::connection ShowHideSidePanelsconn; + bool isProcessing; + + public: EditorPanel (FilePanel* filePanel = NULL); @@ -173,6 +176,8 @@ class EditorPanel : public Gtk::VBox, Glib::ustring getFileName (); bool handleShortcutKey (GdkEventKey* event); + bool getIsProcessing() const { return isProcessing; } + Gtk::Paned *catalogPane; }; diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index bd5a174f1..ea7ecec4f 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -273,6 +273,8 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) { } void RTWindow::remEditorPanel (EditorPanel* ep) { + if (ep->getIsProcessing()) return; // Will crash if destroyed while loading + if (EditWindow::isMultiDisplayEnabled()) { EditWindow * wndEdit = EditWindow::getInstance(this); wndEdit->remEditorPanel(ep); @@ -347,6 +349,23 @@ void RTWindow::addBatchQueueJobs (std::vector &entries) { } bool RTWindow::on_delete_event(GdkEventAny* event) { + // Check if any editor is still processing, and do NOT quit if so. Otherwise crashes and inconsistent caches + bool isProcessing=false; + + if (isSingleTabMode() || simpleEditor) + isProcessing=epanel->getIsProcessing(); + else { + int pageCount=mainNB->get_n_pages(); + + // First and second are file browser and batch queue + if (pageCount>2) { + for (int i=2;iget_nth_page(i))->getIsProcessing(); + } + } + + if (isProcessing) return true; + if( fpanel ) fpanel->saveOptions ();