Stop the queue if error saving, Issue 2257 and Segfault on indexed PNG, Issue 2556

This commit is contained in:
Ingo
2014-11-28 00:09:55 +01:00
parent fb6861e481
commit 5980774a76
6 changed files with 154 additions and 68 deletions

View File

@@ -608,7 +608,8 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
err = img->saveAsJPEG (fname, saveFormat.jpegQuality, saveFormat.jpegSubSamp);
img->free ();
if (err) throw Glib::FileError(Glib::FileError::FAILED, M("MAIN_MSG_CANNOTSAVE"));
if (err)
throw Glib::FileError(Glib::FileError::FAILED, M("MAIN_MSG_CANNOTSAVE")+"\n"+fname);
if (saveFormat.saveParams) {
// We keep the extension to avoid overwriting the profile when we have
@@ -626,13 +627,17 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
Glib::ustring processedParams = processing->savedParamsFile;
// delete from the queue
delete processing; processing = NULL;
bool queueEmptied=false;
bool remove_button_set = false;
{
// TODO: Check for Linux
#if PROTECT_VECTORS
MYWRITERLOCK(l, entryRW);
#endif
delete processing;
processing = NULL;
fd.erase (fd.begin());
@@ -654,13 +659,14 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
processing->selected = false;
}
// remove button set
{
// ButtonSet have Cairo::Surface which might be rendered while we're trying to delete them
GThreadLock lock;
next->removeButtonSet ();
}
remove_button_set = true;
}
}
if (remove_button_set) {
// ButtonSet have Cairo::Surface which might be rendered while we're trying to delete them
GThreadLock lock;
processing->removeButtonSet ();
}
if (saveBatchQueue( )) {
safe_g_remove( processedParams );
// Delete all files in directory \batch when finished, just to be sure to remove zombies

View File

@@ -224,8 +224,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
// Zoom panel
iops->pack_end (*iareapanel->imageArea->zoomPanel, Gtk::PACK_SHRINK, 1);
iops->pack_end (*vsepz3, Gtk::PACK_SHRINK, 2);
navPrev = navNext = navSync = NULL;
navPrev = navNext = navSync = NULL;
if (!simpleEditor && !options.tabbedUI){
// Navigation buttons
Gtk::Image *navPrevImage = Gtk::manage (new RTImage ("nav-prev.png"));
@@ -326,15 +326,15 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
tbRightPanel_1->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::tbRightPanel_1_toggled) );
saveimgas->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::saveAsPressed) );
queueimg->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::queueImgPressed) );
sendtogimp->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::sendToGimpPressed) );
if(navPrev)
sendtogimp->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::sendToGimpPressed) );
if(navPrev)
navPrev->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::openPreviousEditorImage) );
if(navNext)
if(navNext)
navNext->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::openNextEditorImage) );
if(navSync)
if(navSync)
navSync->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::syncFileBrowser) );
ShowHideSidePanelsconn = tbShowHideSidePanels->signal_toggled().connect ( sigc::mem_fun(*this, &EditorPanel::toggleSidePanels), true);
if (tbTopPanel_1)
if (tbTopPanel_1)
tbTopPanel_1->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::tbTopPanel_1_toggled) );
}
@@ -699,17 +699,21 @@ void EditorPanel::refreshProcessingState (bool inProcessingP) {
struct errparams {
Glib::ustring descr;
Glib::ustring title;
EditorPanelIdleHelper* epih;
};
void EditorPanel::displayError (Glib::ustring descr) {
if (parent) {
Gtk::MessageDialog* msgd = new Gtk::MessageDialog (*parent, descr, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd->set_title (M("MAIN_MSG_CANNOTSAVE"));
msgd->run ();
delete msgd;
}
void EditorPanel::displayError (Glib::ustring title, Glib::ustring descr) {
GtkWidget* msgd = gtk_message_dialog_new_with_markup (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
descr.data());
gtk_window_set_title((GtkWindow*)msgd, title.data());
g_signal_connect_swapped (msgd, "response",
G_CALLBACK (gtk_widget_destroy),
msgd);
gtk_widget_show_all (msgd);
}
int disperrorUI (void* data) {
@@ -725,18 +729,19 @@ int disperrorUI (void* data) {
return 0;
}
p->epih->epanel->displayError (p->descr);
p->epih->epanel->displayError (p->title, p->descr);
p->epih->pending--;
delete p;
return 0;
}
void EditorPanel::error (Glib::ustring descr) {
void EditorPanel::error (Glib::ustring title, Glib::ustring descr) {
epih->pending++;
errparams* p = new errparams;
p->descr = descr;
p->title = title;
p->epih = epih;
g_idle_add (disperrorUI, p);
}
@@ -1129,8 +1134,7 @@ bool EditorPanel::idle_imageSaved(ProgressConnector<int> *pc,rtengine::IImage16*
}
} else {
Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": Error during image saving\n</b>";
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
error(M("MAIN_MSG_CANNOTSAVE"), "<b>"+fname+"</b>");
}
saveimgas->set_sensitive(true);

View File

@@ -153,8 +153,8 @@ class EditorPanel : public Gtk::VBox,
void setProgress (double p);
void setProgressStr (Glib::ustring str);
void setProgressState (bool inProcessing);
void error (Glib::ustring descr);
void displayError (Glib::ustring descr); // this is called by error in the gtk thread
void error (Glib::ustring title, Glib::ustring descr);
void displayError (Glib::ustring title, Glib::ustring descr); // this is called by error in the gtk thread
void refreshProcessingState (bool inProcessing); // this is called by setProcessingState in the gtk thread
// PParamsChangeListener interface