@@ -17635,7 +17635,7 @@ PropertiesFile::PropertiesFile (const File& f, const int millisecondsBeforeSavin | |||||
|| (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsCompressedBinary | || (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsCompressedBinary | ||||
|| (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsXML); | || (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsXML); | ||||
ProcessScopedLock pl (getProcessLock()); | |||||
ProcessScopedLock pl (createProcessLock()); | |||||
ScopedPointer<InputStream> fileStream (f.createInputStream()); | ScopedPointer<InputStream> fileStream (f.createInputStream()); | ||||
@@ -17717,9 +17717,9 @@ PropertiesFile::~PropertiesFile() | |||||
jassertfalse; | jassertfalse; | ||||
} | } | ||||
PropertiesFile::ProcessScopedLock PropertiesFile::getProcessLock() const | |||||
InterProcessLock::ScopedLockType* PropertiesFile::createProcessLock() const | |||||
{ | { | ||||
return ProcessScopedLock (processLock != 0 ? new InterProcessLock::ScopedLockType (*processLock) : 0); | |||||
return processLock != 0 ? new InterProcessLock::ScopedLockType (*processLock) : 0; | |||||
} | } | ||||
bool PropertiesFile::saveIfNeeded() | bool PropertiesFile::saveIfNeeded() | ||||
@@ -17771,7 +17771,7 @@ bool PropertiesFile::save() | |||||
getAllProperties().getAllValues() [i]); | getAllProperties().getAllValues() [i]); | ||||
} | } | ||||
ProcessScopedLock pl (getProcessLock()); | |||||
ProcessScopedLock pl (createProcessLock()); | |||||
if (doc.writeToFile (file, String::empty)) | if (doc.writeToFile (file, String::empty)) | ||||
{ | { | ||||
@@ -17781,7 +17781,7 @@ bool PropertiesFile::save() | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
ProcessScopedLock pl (getProcessLock()); | |||||
ProcessScopedLock pl (createProcessLock()); | |||||
TemporaryFile tempFile (file); | TemporaryFile tempFile (file); | ||||
ScopedPointer <OutputStream> out (tempFile.getFile().createOutputStream()); | ScopedPointer <OutputStream> out (tempFile.getFile().createOutputStream()); | ||||
@@ -17887,7 +17887,7 @@ PropertiesFile* PropertiesFile::createDefaultAppPropertiesFile (const String& ap | |||||
const bool commonToAllUsers, | const bool commonToAllUsers, | ||||
const int millisecondsBeforeSaving, | const int millisecondsBeforeSaving, | ||||
const int propertiesFileOptions, | const int propertiesFileOptions, | ||||
InterProcessLock *processLock_) | |||||
InterProcessLock* processLock_) | |||||
{ | { | ||||
const File file (getDefaultAppSettingsFile (applicationName, | const File file (getDefaultAppSettingsFile (applicationName, | ||||
fileNameSuffix, | fileNameSuffix, | ||||
@@ -3484,6 +3484,10 @@ private: | |||||
// (Required as an alternative to the overloaded & operator). | // (Required as an alternative to the overloaded & operator). | ||||
const ScopedPointer* getAddress() const throw() { return this; } | const ScopedPointer* getAddress() const throw() { return this; } | ||||
// This is private to stop people accidentally copying a const ScopedPointer (the compiler | |||||
// will let you do so by implicitly casting the source to its raw object pointer). | |||||
ScopedPointer (const ScopedPointer&); | |||||
}; | }; | ||||
template <class ObjectType> | template <class ObjectType> | ||||
@@ -13480,7 +13484,7 @@ public: | |||||
bool commonToAllUsers, | bool commonToAllUsers, | ||||
int millisecondsBeforeSaving, | int millisecondsBeforeSaving, | ||||
int propertiesFileOptions, | int propertiesFileOptions, | ||||
InterProcessLock *ipl = NULL); | |||||
InterProcessLock* processLock = 0); | |||||
static const File getDefaultAppSettingsFile (const String& applicationName, | static const File getDefaultAppSettingsFile (const String& applicationName, | ||||
const String& fileNameSuffix, | const String& fileNameSuffix, | ||||
@@ -13500,8 +13504,8 @@ private: | |||||
bool loadedOk, needsWriting; | bool loadedOk, needsWriting; | ||||
InterProcessLock* processLock; | InterProcessLock* processLock; | ||||
typedef ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock; | |||||
ProcessScopedLock getProcessLock() const; | |||||
typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock; | |||||
InterProcessLock::ScopedLockType* createProcessLock() const; | |||||
void timerCallback(); | void timerCallback(); | ||||
@@ -166,6 +166,10 @@ private: | |||||
// (Required as an alternative to the overloaded & operator). | // (Required as an alternative to the overloaded & operator). | ||||
const ScopedPointer* getAddress() const throw() { return this; } | const ScopedPointer* getAddress() const throw() { return this; } | ||||
// This is private to stop people accidentally copying a const ScopedPointer (the compiler | |||||
// will let you do so by implicitly casting the source to its raw object pointer). | |||||
ScopedPointer (const ScopedPointer&); | |||||
}; | }; | ||||
//============================================================================== | //============================================================================== | ||||
@@ -69,7 +69,7 @@ PropertiesFile::PropertiesFile (const File& f, const int millisecondsBeforeSavin | |||||
|| (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsCompressedBinary | || (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsCompressedBinary | ||||
|| (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsXML); | || (options_ & (storeAsBinary | storeAsCompressedBinary | storeAsXML)) == storeAsXML); | ||||
ProcessScopedLock pl (getProcessLock()); | |||||
ProcessScopedLock pl (createProcessLock()); | |||||
ScopedPointer<InputStream> fileStream (f.createInputStream()); | ScopedPointer<InputStream> fileStream (f.createInputStream()); | ||||
@@ -151,9 +151,9 @@ PropertiesFile::~PropertiesFile() | |||||
jassertfalse; | jassertfalse; | ||||
} | } | ||||
PropertiesFile::ProcessScopedLock PropertiesFile::getProcessLock() const | |||||
InterProcessLock::ScopedLockType* PropertiesFile::createProcessLock() const | |||||
{ | { | ||||
return ProcessScopedLock (processLock != 0 ? new InterProcessLock::ScopedLockType (*processLock) : 0); | |||||
return processLock != 0 ? new InterProcessLock::ScopedLockType (*processLock) : 0; | |||||
} | } | ||||
bool PropertiesFile::saveIfNeeded() | bool PropertiesFile::saveIfNeeded() | ||||
@@ -205,7 +205,7 @@ bool PropertiesFile::save() | |||||
getAllProperties().getAllValues() [i]); | getAllProperties().getAllValues() [i]); | ||||
} | } | ||||
ProcessScopedLock pl (getProcessLock()); | |||||
ProcessScopedLock pl (createProcessLock()); | |||||
if (doc.writeToFile (file, String::empty)) | if (doc.writeToFile (file, String::empty)) | ||||
{ | { | ||||
@@ -215,7 +215,7 @@ bool PropertiesFile::save() | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
ProcessScopedLock pl (getProcessLock()); | |||||
ProcessScopedLock pl (createProcessLock()); | |||||
TemporaryFile tempFile (file); | TemporaryFile tempFile (file); | ||||
ScopedPointer <OutputStream> out (tempFile.getFile().createOutputStream()); | ScopedPointer <OutputStream> out (tempFile.getFile().createOutputStream()); | ||||
@@ -322,7 +322,7 @@ PropertiesFile* PropertiesFile::createDefaultAppPropertiesFile (const String& ap | |||||
const bool commonToAllUsers, | const bool commonToAllUsers, | ||||
const int millisecondsBeforeSaving, | const int millisecondsBeforeSaving, | ||||
const int propertiesFileOptions, | const int propertiesFileOptions, | ||||
InterProcessLock *processLock_) | |||||
InterProcessLock* processLock_) | |||||
{ | { | ||||
const File file (getDefaultAppSettingsFile (applicationName, | const File file (getDefaultAppSettingsFile (applicationName, | ||||
fileNameSuffix, | fileNameSuffix, | ||||
@@ -155,7 +155,7 @@ public: | |||||
bool commonToAllUsers, | bool commonToAllUsers, | ||||
int millisecondsBeforeSaving, | int millisecondsBeforeSaving, | ||||
int propertiesFileOptions, | int propertiesFileOptions, | ||||
InterProcessLock *ipl = NULL); | |||||
InterProcessLock* processLock = 0); | |||||
/** Handy utility to choose a file in the standard OS-dependent location for application | /** Handy utility to choose a file in the standard OS-dependent location for application | ||||
settings files. | settings files. | ||||
@@ -197,8 +197,8 @@ private: | |||||
bool loadedOk, needsWriting; | bool loadedOk, needsWriting; | ||||
InterProcessLock* processLock; | InterProcessLock* processLock; | ||||
typedef ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock; | |||||
ProcessScopedLock getProcessLock() const; | |||||
typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock; | |||||
InterProcessLock::ScopedLockType* createProcessLock() const; | |||||
void timerCallback(); | void timerCallback(); | ||||