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 )
This commit is contained in:
Hombre
2013-09-10 01:07:53 +02:00
parent 7d04b6638d
commit c342288cf7
5 changed files with 39 additions and 38 deletions

View File

@@ -43,30 +43,30 @@ const char* wpgamma[] = {"default","BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linea
//low g=2.6 s=6.9 for low contrast images //low g=2.6 s=6.9 for low contrast images
std::vector<std::string> getGamma () {//return gamma std::vector<Glib::ustring> getGamma () {//return gamma
std::vector<std::string> res; std::vector<Glib::ustring> res;
for (unsigned int i=0; i<sizeof(wpgamma)/sizeof(wpgamma[0]); i++) for (unsigned int i=0; i<sizeof(wpgamma)/sizeof(wpgamma[0]); i++)
res.push_back (wpgamma[i]); res.push_back (wpgamma[i]);
return res; return res;
} }
std::vector<std::string> getWorkingProfiles () { std::vector<Glib::ustring> getWorkingProfiles () {
std::vector<std::string> res; std::vector<Glib::ustring> res;
for (unsigned int i=0; i<sizeof(wpnames)/sizeof(wpnames[0]); i++) for (unsigned int i=0; i<sizeof(wpnames)/sizeof(wpnames[0]); i++)
res.push_back (wpnames[i]); res.push_back (wpnames[i]);
return res; return res;
} }
std::vector<std::string> ICCStore::getOutputProfiles () { std::vector<Glib::ustring> ICCStore::getOutputProfiles () {
MyMutex::MyLock lock(mutex_); MyMutex::MyLock lock(mutex_);
std::vector<std::string> res; std::vector<Glib::ustring> res;
for (std::map<std::string, cmsHPROFILE>::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){ for (std::map<Glib::ustring, cmsHPROFILE>::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){
std::string name(i->first); Glib::ustring name(i->first);
std::string::size_type i2 = name.find_last_of('/'); std::string::size_type i2 = name.find_last_of('/');
if( i2 == std::string::npos ) if( i2 == std::string::npos )
i2 = name.find_last_of('\\'); i2 = name.find_last_of('\\');
@@ -117,7 +117,7 @@ int ICCStore::numOfWProfiles () {
TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) { TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) {
std::map<std::string, TMatrix>::iterator r = wMatrices.find (name); std::map<Glib::ustring, TMatrix>::iterator r = wMatrices.find (name);
if (r!=wMatrices.end()) if (r!=wMatrices.end())
return r->second; return r->second;
else else
@@ -126,7 +126,7 @@ TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) {
TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) { TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) {
std::map<std::string, TMatrix>::iterator r = iwMatrices.find (name); std::map<Glib::ustring, TMatrix>::iterator r = iwMatrices.find (name);
if (r!=iwMatrices.end()) if (r!=iwMatrices.end())
return r->second; return r->second;
else else
@@ -135,7 +135,7 @@ TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) {
cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) { cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) {
std::map<std::string, cmsHPROFILE>::iterator r = wProfiles.find (name); std::map<Glib::ustring, cmsHPROFILE>::iterator r = wProfiles.find (name);
if (r!=wProfiles.end()) if (r!=wProfiles.end())
return r->second; return r->second;
else else
@@ -144,7 +144,7 @@ cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) {
cmsHPROFILE ICCStore::workingSpaceGamma (Glib::ustring name) { cmsHPROFILE ICCStore::workingSpaceGamma (Glib::ustring name) {
std::map<std::string, cmsHPROFILE>::iterator r = wProfilesGamma.find (name); std::map<Glib::ustring, cmsHPROFILE>::iterator r = wProfilesGamma.find (name);
if (r!=wProfilesGamma.end()) if (r!=wProfilesGamma.end())
return r->second; return r->second;
else else
@@ -155,7 +155,7 @@ cmsHPROFILE ICCStore::getProfile (Glib::ustring name) {
MyMutex::MyLock lock(mutex_); MyMutex::MyLock lock(mutex_);
std::map<std::string, cmsHPROFILE>::iterator r = fileProfiles.find (name); std::map<Glib::ustring, cmsHPROFILE>::iterator r = fileProfiles.find (name);
if (r!=fileProfiles.end()) if (r!=fileProfiles.end())
return r->second; return r->second;
else { else {
@@ -179,7 +179,7 @@ cmsHPROFILE ICCStore::getStdProfile (Glib::ustring name) {
MyMutex::MyLock lock(mutex_); MyMutex::MyLock lock(mutex_);
std::map<std::string, cmsHPROFILE>::iterator r = fileStdProfiles.find (name.uppercase()); std::map<Glib::ustring, cmsHPROFILE>::iterator r = fileStdProfiles.find (name.uppercase());
if (r==fileStdProfiles.end()) return NULL; if (r==fileStdProfiles.end()) return NULL;
return r->second; 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); loadICCs(Glib::build_filename(rtICCDir, "input"), true, fileStdProfiles, fileStdProfileContents);
} }
void ICCStore::loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<std::string, cmsHPROFILE>& resultProfiles, std::map<std::string, ProfileContent> &resultProfileContents) { void ICCStore::loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<Glib::ustring, cmsHPROFILE>& resultProfiles, std::map<Glib::ustring, ProfileContent> &resultProfileContents) {
if (rootDirName!="") { if (rootDirName!="") {
std::deque<Glib::ustring> qDirs; std::deque<Glib::ustring> qDirs;

View File

@@ -46,18 +46,18 @@ class ProfileContent {
class ICCStore { class ICCStore {
std::map<std::string, cmsHPROFILE> wProfiles; std::map<Glib::ustring, cmsHPROFILE> wProfiles;
std::map<std::string, cmsHPROFILE> wProfilesGamma; std::map<Glib::ustring, cmsHPROFILE> wProfilesGamma;
std::map<std::string, TMatrix> wMatrices; std::map<Glib::ustring, TMatrix> wMatrices;
std::map<std::string, TMatrix> iwMatrices; std::map<Glib::ustring, TMatrix> iwMatrices;
// these contain profiles from user/system directory (supplied on init) // these contain profiles from user/system directory (supplied on init)
std::map<std::string, cmsHPROFILE> fileProfiles; std::map<Glib::ustring, cmsHPROFILE> fileProfiles;
std::map<std::string, ProfileContent> fileProfileContents; std::map<Glib::ustring, ProfileContent> fileProfileContents;
// these contain standard profiles from RT. keys are all in uppercase // these contain standard profiles from RT. keys are all in uppercase
std::map<std::string, cmsHPROFILE> fileStdProfiles; std::map<Glib::ustring, cmsHPROFILE> fileStdProfiles;
std::map<std::string, ProfileContent> fileStdProfileContents; std::map<Glib::ustring, ProfileContent> fileStdProfileContents;
cmsHPROFILE xyz; cmsHPROFILE xyz;
cmsHPROFILE srgb; cmsHPROFILE srgb;
@@ -65,7 +65,7 @@ class ICCStore {
MyMutex mutex_; MyMutex mutex_;
ICCStore (); ICCStore ();
void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<std::string, cmsHPROFILE>& resultProfiles, std::map<std::string, ProfileContent> &resultProfileContents); void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<Glib::ustring, cmsHPROFILE>& resultProfiles, std::map<Glib::ustring, ProfileContent> &resultProfileContents);
public: public:
@@ -89,7 +89,7 @@ class ICCStore {
cmsHPROFILE getXYZProfile () { return xyz; } cmsHPROFILE getXYZProfile () { return xyz; }
cmsHPROFILE getsRGBProfile () { return srgb; } cmsHPROFILE getsRGBProfile () { return srgb; }
std::vector<std::string> getOutputProfiles (); std::vector<Glib::ustring> getOutputProfiles ();
}; };
#define iccStore ICCStore::getInstance() #define iccStore ICCStore::getInstance()

View File

@@ -357,9 +357,10 @@ namespace rtengine {
/** Returns the available working profile names /** Returns the available working profile names
* @return a vector of the available working profile names */ * @return a vector of the available working profile names */
std::vector<std::string> getWorkingProfiles (); std::vector<Glib::ustring> getWorkingProfiles ();
/** return gamma */ /** Returns the available output gammas
std::vector<std::string> getGamma (); * @return a vector of the available gamma names */
std::vector<Glib::ustring> getGamma ();
/** This class holds all the necessary informations to accomplish the full processing of the image */ /** This class holds all the necessary informations to accomplish the full processing of the image */
class ProcessingJob { class ProcessingJob {

View File

@@ -395,7 +395,7 @@ else ipf.ciecam_02 (cieView, adap, begh, endh,1, 2, labView, &params,customColCu
bool pro=false; bool pro=false;
Glib::ustring chpro, outProfile; Glib::ustring chpro, outProfile;
bool present_space[9]={false,false,false,false,false,false,false,false,false}; bool present_space[9]={false,false,false,false,false,false,false,false,false};
std::vector<std::string> opnames = iccStore->getOutputProfiles (); std::vector<Glib::ustring> opnames = iccStore->getOutputProfiles ();
//test if files are in system //test if files are in system
for (int j=0; j<9; j++) { 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 ?? // one can modify "option" [Color Management] to adapt the profile's name if they are different for windows, MacOS, Linux ??

View File

@@ -125,7 +125,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
wnames = Gtk::manage (new MyComboBoxText ()); wnames = Gtk::manage (new MyComboBoxText ());
wVBox->pack_start (*wnames, Gtk::PACK_SHRINK); wVBox->pack_start (*wnames, Gtk::PACK_SHRINK);
std::vector<std::string> wpnames = rtengine::getWorkingProfiles (); std::vector<Glib::ustring> wpnames = rtengine::getWorkingProfiles ();
for (size_t i=0; i<wpnames.size(); i++) for (size_t i=0; i<wpnames.size(); i++)
wnames->append_text (wpnames[i]); wnames->append_text (wpnames[i]);
@@ -152,7 +152,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
onames->append_text (M("TP_ICM_NOICM")); onames->append_text (M("TP_ICM_NOICM"));
onames->set_active (0); onames->set_active (0);
std::vector<std::string> opnames = iccStore->getOutputProfiles (); std::vector<Glib::ustring> opnames = iccStore->getOutputProfiles ();
for (size_t i=0; i<opnames.size(); i++) for (size_t i=0; i<opnames.size(); i++)
onames->append_text (opnames[i]); onames->append_text (opnames[i]);
@@ -170,7 +170,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
oVBox->pack_start(*gaHBox, Gtk::PACK_EXPAND_WIDGET,2); oVBox->pack_start(*gaHBox, Gtk::PACK_EXPAND_WIDGET,2);
std::vector<std::string> wpgamma = rtengine::getGamma (); std::vector<Glib::ustring> wpgamma = rtengine::getGamma ();
for (size_t i=0; i<wpgamma.size(); i++) for (size_t i=0; i<wpgamma.size(); i++)
wgamma->append_text (wpgamma[i]); wgamma->append_text (wpgamma[i]);