Fixed issue #417; crash in single tab mode after currently edited image was deleted

This commit is contained in:
Oliver Duis
2010-12-24 13:40:37 +01:00
parent 0b93426042
commit 2015377d84
2 changed files with 15 additions and 5 deletions

View File

@@ -1,7 +1,8 @@
/* /*
* This file is part of RawTherapee. * This file is part of RawTherapee.
* *
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>, Oliver Duis <www.oliverduis.de> * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
* Copyright (c) 2010 Oliver Duis <www.oliverduis.de>
* *
* RawTherapee is free software: you can redistribute it and/or modify * RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -323,6 +324,8 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
openThm = tmb; openThm = tmb;
openThm->increaseRef (); openThm->increaseRef ();
fname=openThm->getFileName();
previewHandler = new PreviewHandler (); previewHandler = new PreviewHandler ();
this->isrc = isrc; this->isrc = isrc;
@@ -347,7 +350,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
const CacheImageData* cfs=openThm->getCacheImageData(); const CacheImageData* cfs=openThm->getCacheImageData();
if (!options.customProfileBuilder.empty() && !openThm->hasProcParams() && cfs && cfs->exifValid) { if (!options.customProfileBuilder.empty() && !openThm->hasProcParams() && cfs && cfs->exifValid) {
// For the filename etc. do NOT use streams, since they are not UTF8 safe // For the filename etc. do NOT use streams, since they are not UTF8 safe
Glib::ustring cmdLine=Glib::ustring("\"") + options.customProfileBuilder + Glib::ustring("\" \"") + openThm->getFileName() + Glib::ustring("\" \"") Glib::ustring cmdLine=Glib::ustring("\"") + options.customProfileBuilder + Glib::ustring("\" \"") + fname + Glib::ustring("\" \"")
+ options.rtdir + Glib::ustring("/") + options.profilePath + Glib::ustring("/") + defProf + Glib::ustring(".pp3") + Glib::ustring("\" "); + options.rtdir + Glib::ustring("/") + options.profilePath + Glib::ustring("/") + defProf + Glib::ustring(".pp3") + Glib::ustring("\" ");
// ustring doesn't know int etc formatting, so take these via (unsafe) stream // ustring doesn't know int etc formatting, so take these via (unsafe) stream
@@ -421,17 +424,20 @@ void EditorPanel::close () {
iarea->imageArea->setImProcCoordinator (NULL); iarea->imageArea->setImProcCoordinator (NULL);
} }
navigator->previewWindow->setPreviewHandler (NULL); navigator->previewWindow->setPreviewHandler (NULL);
// navigator->previewWindow->setImageArea (NULL);
// If the file was deleted somewhere, the openThm.descreaseRef delete the object, but we don't know here
if (safe_file_test(fname, Glib::FILE_TEST_EXISTS)) {
openThm->removeThumbnailListener (this); openThm->removeThumbnailListener (this);
openThm->decreaseRef (); openThm->decreaseRef ();
}
} }
} }
void EditorPanel::saveProfile () { void EditorPanel::saveProfile () {
if (!ipc || !openThm) return; if (!ipc || !openThm) return;
// If the file was deleted, do not generate ghost entries
if (safe_file_test(fname, Glib::FILE_TEST_EXISTS)) {
ProcParams params; ProcParams params;
ipc->getParams (&params); ipc->getParams (&params);
@@ -440,6 +446,7 @@ void EditorPanel::saveProfile () {
if (options.saveParamsCache) if (options.saveParamsCache)
openThm->setProcParams (params, EDITOR); openThm->setProcParams (params, EDITOR);
} }
}
Glib::ustring EditorPanel::getShortName () { Glib::ustring EditorPanel::getShortName () {

View File

@@ -2,6 +2,7 @@
* This file is part of RawTherapee. * This file is part of RawTherapee.
* *
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
* Copyright (c) 2010 Oliver Duis <www.oliverduis.de>
* *
* RawTherapee is free software: you can redistribute it and/or modify * RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -86,7 +87,9 @@ class EditorPanel : public Gtk::VBox,
FilePanel* fPanel; FilePanel* fPanel;
Thumbnail* openThm; Thumbnail* openThm; // may get invalid on external delete event
Glib::ustring fname; // must be safed seperately
rtengine::InitialImage* isrc; rtengine::InitialImage* isrc;
rtengine::StagedImageProcessor* ipc; rtengine::StagedImageProcessor* ipc;
rtengine::StagedImageProcessor* beforeIpc; // for the before-after view rtengine::StagedImageProcessor* beforeIpc; // for the before-after view