mirror of
https://github.com/glest/glest-source.git
synced 2025-08-09 09:56:30 +02:00
- updated code to protect against null pointers and uninitialized values and threading issues
This commit is contained in:
@@ -74,14 +74,16 @@ protected:
|
||||
}
|
||||
|
||||
}
|
||||
try {
|
||||
Mutex &mutexCache = manageCachedItemMutex<T>(cacheKey);
|
||||
MutexSafeWrapper safeMutex(&mutexCache);
|
||||
itemCache[cacheKey] = *value;
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
throw megaglest_runtime_error(ex.what());
|
||||
if(value != NULL) {
|
||||
try {
|
||||
Mutex &mutexCache = manageCachedItemMutex<T>(cacheKey);
|
||||
MutexSafeWrapper safeMutex(&mutexCache);
|
||||
itemCache[cacheKey] = *value;
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
throw megaglest_runtime_error(ex.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
// If this is the first access we return a default object of the type
|
||||
|
@@ -212,6 +212,8 @@ typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
#if (_MSC_VER < 1700)
|
||||
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
@@ -221,6 +223,8 @@ typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
#endif
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
|
Reference in New Issue
Block a user