Simplify the DCLP singleton instances found by searching for methods named 'getInstance'.
This commit is contained in:
@@ -1691,18 +1691,8 @@ void DCPProfile::step2ApplyTile(float *rc, float *gc, float *bc, int width, int
|
|||||||
// Generates as singleton
|
// Generates as singleton
|
||||||
DCPStore* DCPStore::getInstance()
|
DCPStore* DCPStore::getInstance()
|
||||||
{
|
{
|
||||||
static DCPStore* instance_ = 0;
|
static DCPStore instance_;
|
||||||
|
return &instance_;
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
static MyMutex smutex_;
|
|
||||||
MyMutex::MyLock lock(smutex_);
|
|
||||||
|
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
instance_ = new DCPStore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads all profiles from the given profiles dir
|
// Reads all profiles from the given profiles dir
|
||||||
|
@@ -192,18 +192,8 @@ ICCStore::makeStdGammaProfile(cmsHPROFILE iprof)
|
|||||||
ICCStore*
|
ICCStore*
|
||||||
ICCStore::getInstance(void)
|
ICCStore::getInstance(void)
|
||||||
{
|
{
|
||||||
static ICCStore* instance_ = 0;
|
static ICCStore instance_;
|
||||||
|
return &instance_;
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
static MyMutex smutex_;
|
|
||||||
MyMutex::MyLock lock(smutex_);
|
|
||||||
|
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
instance_ = new ICCStore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ICCStore::ICCStore ()
|
ICCStore::ICCStore ()
|
||||||
|
@@ -781,18 +781,8 @@ void XMLCALL LCPProfile::XmlEndHandler(void *pLCPProfile, const char *el)
|
|||||||
// Generates as singleton
|
// Generates as singleton
|
||||||
LCPStore* LCPStore::getInstance()
|
LCPStore* LCPStore::getInstance()
|
||||||
{
|
{
|
||||||
static LCPStore* instance_ = 0;
|
static LCPStore instance_;
|
||||||
|
return &instance_;
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
static MyMutex smutex_;
|
|
||||||
MyMutex::MyLock lock(smutex_);
|
|
||||||
|
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
instance_ = new LCPStore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LCPProfile* LCPStore::getProfile (Glib::ustring filename)
|
LCPProfile* LCPStore::getProfile (Glib::ustring filename)
|
||||||
|
@@ -74,18 +74,8 @@ bool ExtProgAction::Execute(std::vector<Glib::ustring> fileNames)
|
|||||||
// Generates as singleton
|
// Generates as singleton
|
||||||
ExtProgStore* ExtProgStore::getInstance()
|
ExtProgStore* ExtProgStore::getInstance()
|
||||||
{
|
{
|
||||||
static ExtProgStore* instance_ = 0;
|
static ExtProgStore instance_;
|
||||||
|
return &instance_;
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
static MyMutex smutex_;
|
|
||||||
MyMutex::MyLock lock(smutex_);
|
|
||||||
|
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
instance_ = new ExtProgStore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtProgStore::~ExtProgStore()
|
ExtProgStore::~ExtProgStore()
|
||||||
|
@@ -168,19 +168,8 @@ PreviewLoader::PreviewLoader():
|
|||||||
|
|
||||||
PreviewLoader* PreviewLoader::getInstance(void)
|
PreviewLoader* PreviewLoader::getInstance(void)
|
||||||
{
|
{
|
||||||
// this will not be deleted...
|
static PreviewLoader instance_;
|
||||||
static PreviewLoader* instance_ = NULL;
|
return &instance_;
|
||||||
|
|
||||||
if ( instance_ == NULL ) {
|
|
||||||
static MyMutex smutex_;
|
|
||||||
MyMutex::MyLock lock(smutex_);
|
|
||||||
|
|
||||||
if ( instance_ == NULL ) {
|
|
||||||
instance_ = new PreviewLoader();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewLoader::add(int dir_id, const Glib::ustring& dir_entry, PreviewLoaderListener* l)
|
void PreviewLoader::add(int dir_id, const Glib::ustring& dir_entry, PreviewLoaderListener* l)
|
||||||
|
@@ -192,14 +192,8 @@ public:
|
|||||||
ThumbImageUpdater*
|
ThumbImageUpdater*
|
||||||
ThumbImageUpdater::getInstance(void)
|
ThumbImageUpdater::getInstance(void)
|
||||||
{
|
{
|
||||||
// this will not be deleted...
|
static ThumbImageUpdater instance_;
|
||||||
static ThumbImageUpdater* instance_ = 0;
|
return &instance_;
|
||||||
|
|
||||||
if ( instance_ == 0 ) {
|
|
||||||
instance_ = new ThumbImageUpdater();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThumbImageUpdater::ThumbImageUpdater():
|
ThumbImageUpdater::ThumbImageUpdater():
|
||||||
|
Reference in New Issue
Block a user