From 4110fe51b27c8fa50ef853fdb170d25cc62984cf Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Wed, 20 Aug 2014 09:59:12 +1000 Subject: [PATCH] Fixed thread statics. --- Engine/source/core/threadStatic.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/core/threadStatic.h b/Engine/source/core/threadStatic.h index 2f5a16cbf..830ba260c 100644 --- a/Engine/source/core/threadStatic.h +++ b/Engine/source/core/threadStatic.h @@ -52,6 +52,7 @@ public: static const U32 getListIndex(){ return mListIndex; } virtual void *getMemInstPtr() = 0; + virtual const void *getConstMemInstPtr() const = 0; virtual const dsize_t getMemInstSize() const = 0; #ifdef TORQUE_ENABLE_THREAD_STATIC_METRICS @@ -143,6 +144,7 @@ private: public: TorqueThreadStatic( T instanceVal ) : mInstance( instanceVal ) {} virtual void *getMemInstPtr() { return &mInstance; } + virtual const void *getConstMemInstPtr() const { return &mInstance; } // I am not sure these are needed, and I don't want to create confusing-to-debug code #if 0 @@ -181,7 +183,7 @@ public: \ _##name##TorqueThreadStatic() : TorqueThreadStatic( initalvalue ) {} \ virtual const dsize_t getMemInstSize() const { return sizeof( type ); } \ type &_cast() { return *reinterpret_cast( getMemInstPtr() ); } \ - const type &_const_cast() const { return *reinterpret_cast( getMemInstPtr() ); } \ + const type &_const_cast() const { return *reinterpret_cast( getConstMemInstPtr() ); } \ }; \ static _##name##TorqueThreadStatic name##TorqueThreadStatic; \ static _TorqueThreadStaticReg _##name##TTSReg( reinterpret_cast<_TorqueThreadStatic *>( & name##TorqueThreadStatic ) )