From c342288cf7c62e0f0184482b8b328ae2f85f194a Mon Sep 17 00:00:00 2001 From: Hombre Date: Tue, 10 Sep 2013 01:07:53 +0200 Subject: [PATCH] Solving issue 1947: "RT frequently "forgets" ICM's working profile and crashes shortly after" Also seems to fix frequent crash on Win32 ( http://rawtherapee.com/forum/viewtopic.php?f=3&t=4628 ) --- rtengine/iccstore.cc | 42 +++++++++++++++++++-------------------- rtengine/iccstore.h | 20 +++++++++---------- rtengine/rtengine.h | 7 ++++--- rtengine/simpleprocess.cc | 2 +- rtgui/icmpanel.cc | 6 +++--- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 6a9c113cf..b604f26aa 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -33,7 +33,7 @@ namespace rtengine { const double (*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best}; const double (*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz}; -const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB"}; +const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB"}; const char* wpgamma[] = {"default","BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35","Low_g2.6_s6.9"}; //gamma free //default = gamma inside profile //BT709 g=2.22 s=4.5 sRGB g=2.4 s=12.92 @@ -41,36 +41,36 @@ const char* wpgamma[] = {"default","BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linea //std22 g=2.2 std18 g=1.8 // high g=1.3 s=3.35 for high dynamic images //low g=2.6 s=6.9 for low contrast images - -std::vector getGamma () {//return gamma - std::vector res; +std::vector getGamma () {//return gamma + + std::vector res; for (unsigned int i=0; i getWorkingProfiles () { +std::vector getWorkingProfiles () { - std::vector res; + std::vector res; for (unsigned int i=0; i ICCStore::getOutputProfiles () { +std::vector ICCStore::getOutputProfiles () { MyMutex::MyLock lock(mutex_); - std::vector res; - for (std::map::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){ - std::string name(i->first); - std::string::size_type i2 = name.find_last_of('/'); - if( i2 == std::string::npos ) - i2 = name.find_last_of('\\'); - if( i2 == std::string::npos ) + std::vector res; + for (std::map::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){ + Glib::ustring name(i->first); + std::string::size_type i2 = name.find_last_of('/'); + if( i2 == std::string::npos ) + i2 = name.find_last_of('\\'); + if( i2 == std::string::npos ) res.push_back ( name ); // list only profiles inside selected profiles directory } return res; @@ -117,7 +117,7 @@ int ICCStore::numOfWProfiles () { TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) { - std::map::iterator r = wMatrices.find (name); + std::map::iterator r = wMatrices.find (name); if (r!=wMatrices.end()) return r->second; else @@ -126,7 +126,7 @@ TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) { TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) { - std::map::iterator r = iwMatrices.find (name); + std::map::iterator r = iwMatrices.find (name); if (r!=iwMatrices.end()) return r->second; else @@ -135,7 +135,7 @@ TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) { cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) { - std::map::iterator r = wProfiles.find (name); + std::map::iterator r = wProfiles.find (name); if (r!=wProfiles.end()) return r->second; else @@ -144,7 +144,7 @@ cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) { cmsHPROFILE ICCStore::workingSpaceGamma (Glib::ustring name) { - std::map::iterator r = wProfilesGamma.find (name); + std::map::iterator r = wProfilesGamma.find (name); if (r!=wProfilesGamma.end()) return r->second; else @@ -155,7 +155,7 @@ cmsHPROFILE ICCStore::getProfile (Glib::ustring name) { MyMutex::MyLock lock(mutex_); - std::map::iterator r = fileProfiles.find (name); + std::map::iterator r = fileProfiles.find (name); if (r!=fileProfiles.end()) return r->second; else { @@ -179,7 +179,7 @@ cmsHPROFILE ICCStore::getStdProfile (Glib::ustring name) { MyMutex::MyLock lock(mutex_); - std::map::iterator r = fileStdProfiles.find (name.uppercase()); + std::map::iterator r = fileStdProfiles.find (name.uppercase()); if (r==fileStdProfiles.end()) return NULL; return r->second; @@ -211,7 +211,7 @@ void ICCStore::init (Glib::ustring usrICCDir, Glib::ustring rtICCDir) { loadICCs(Glib::build_filename(rtICCDir, "input"), true, fileStdProfiles, fileStdProfileContents); } -void ICCStore::loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map& resultProfiles, std::map &resultProfileContents) { +void ICCStore::loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map& resultProfiles, std::map &resultProfileContents) { if (rootDirName!="") { std::deque qDirs; diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index f6381f54f..90489b67c 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -46,18 +46,18 @@ class ProfileContent { class ICCStore { - std::map wProfiles; - std::map wProfilesGamma; - std::map wMatrices; - std::map iwMatrices; + std::map wProfiles; + std::map wProfilesGamma; + std::map wMatrices; + std::map iwMatrices; // these contain profiles from user/system directory (supplied on init) - std::map fileProfiles; - std::map fileProfileContents; + std::map fileProfiles; + std::map fileProfileContents; // these contain standard profiles from RT. keys are all in uppercase - std::map fileStdProfiles; - std::map fileStdProfileContents; + std::map fileStdProfiles; + std::map fileStdProfileContents; cmsHPROFILE xyz; cmsHPROFILE srgb; @@ -65,7 +65,7 @@ class ICCStore { MyMutex mutex_; ICCStore (); - void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map& resultProfiles, std::map &resultProfileContents); + void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map& resultProfiles, std::map &resultProfileContents); public: @@ -89,7 +89,7 @@ class ICCStore { cmsHPROFILE getXYZProfile () { return xyz; } cmsHPROFILE getsRGBProfile () { return srgb; } - std::vector getOutputProfiles (); + std::vector getOutputProfiles (); }; #define iccStore ICCStore::getInstance() diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index a266d3747..6cd6be613 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -357,9 +357,10 @@ namespace rtengine { /** Returns the available working profile names * @return a vector of the available working profile names */ - std::vector getWorkingProfiles (); -/** return gamma */ - std::vector getGamma (); + std::vector getWorkingProfiles (); +/** Returns the available output gammas + * @return a vector of the available gamma names */ + std::vector getGamma (); /** This class holds all the necessary informations to accomplish the full processing of the image */ class ProcessingJob { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 8e090e163..1c71bf629 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -395,7 +395,7 @@ else ipf.ciecam_02 (cieView, adap, begh, endh,1, 2, labView, ¶ms,customColCu bool pro=false; Glib::ustring chpro, outProfile; bool present_space[9]={false,false,false,false,false,false,false,false,false}; - std::vector opnames = iccStore->getOutputProfiles (); + std::vector opnames = iccStore->getOutputProfiles (); //test if files are in system for (int j=0; j<9; j++) { // one can modify "option" [Color Management] to adapt the profile's name if they are different for windows, MacOS, Linux ?? diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 1b84d623c..6ae640614 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -125,7 +125,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), wnames = Gtk::manage (new MyComboBoxText ()); wVBox->pack_start (*wnames, Gtk::PACK_SHRINK); - std::vector wpnames = rtengine::getWorkingProfiles (); + std::vector wpnames = rtengine::getWorkingProfiles (); for (size_t i=0; iappend_text (wpnames[i]); @@ -152,7 +152,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), onames->append_text (M("TP_ICM_NOICM")); onames->set_active (0); - std::vector opnames = iccStore->getOutputProfiles (); + std::vector opnames = iccStore->getOutputProfiles (); for (size_t i=0; iappend_text (opnames[i]); @@ -170,7 +170,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), oVBox->pack_start(*gaHBox, Gtk::PACK_EXPAND_WIDGET,2); - std::vector wpgamma = rtengine::getGamma (); + std::vector wpgamma = rtengine::getGamma (); for (size_t i=0; iappend_text (wpgamma[i]);