Solving bug reported in issue 1341: "PP3 file cleanup" ...application's crash if the default raw or image profile didn't exist

This commit is contained in:
natureh
2012-05-25 10:42:56 +02:00
parent e5d42eb5eb
commit 6ae731e84a
17 changed files with 386 additions and 61 deletions

View File

@@ -159,7 +159,20 @@ int main(int argc, char **argv)
RTWindow *rtWindow = new class RTWindow();
gdk_threads_enter ();
// alerting users if the default raw and image profiles are missing
if (options.is_defProfRawMissing()) {
Gtk::MessageDialog msgd (Glib::ustring::compose(M("OPTIONS_DEFRAW_MISSING"), options.defProfRaw), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
if (options.is_defProfImgMissing()) {
Gtk::MessageDialog msgd (Glib::ustring::compose(M("OPTIONS_DEFIMG_MISSING"), options.defProfImg), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
// opening the main window
m.run(*rtWindow);
gdk_threads_leave ();
delete rtWindow;
rtengine::cleanup();
@@ -348,16 +361,18 @@ int processLineParams( int argc, char **argv )
if (useDefault) {
rawParams = new rtengine::procparams::PartialProfile(true);
if (rawParams->load(options.profilePath+"/" + options.defProfRaw + paramFileExtension)) {
std::cerr << "Error: default Raw procparams file \""<< (options.profilePath+"/" + options.defProfRaw + paramFileExtension) << "\" not found" << std::endl;
Glib::ustring profPath = options.findProfilePath(options.defProfRaw);
if (options.is_defProfRawMissing() || profPath.empty() || rawParams->load(Glib::build_filename(profPath, options.defProfRaw + paramFileExtension))) {
std::cerr << "Error: default Raw procparams file not found" << std::endl;
rawParams->deleteInstance();
delete rawParams;
deleteProcParams(processingParams);
return -3;
}
imgParams = new rtengine::procparams::PartialProfile(true);
if (imgParams->load(options.profilePath+"/" + options.defProfImg + paramFileExtension)) {
std::cerr << "Error: default Image procparams file \""<< (options.profilePath+"/" + options.defProfImg + paramFileExtension) << "\" not found" << std::endl;
profPath = options.findProfilePath(options.defProfImg);
if (options.is_defProfImgMissing() || profPath.empty() || imgParams->load(Glib::build_filename(profPath, options.defProfImg + paramFileExtension))) {
std::cerr << "Error: default Image procparams file not found" << std::endl;
imgParams->deleteInstance();
delete imgParams;
rawParams->deleteInstance();