Changeset 10635

Show
Ignore:
Timestamp:
10/10/09 13:00:35 (5 years ago)
Author:
robert
Message:

From Mathias Froehlich, "Tha attached change adapt previous attemps to get our application using osg
through microsofts application verifier. The current change should work a
little better ...
The change is based on rev 10605."

Location:
OpenSceneGraph/trunk/src/OpenThreads/win32
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/OpenThreads/win32/Win32Thread.cpp

    r10219 r10635  
    206206Thread* Thread::CurrentThread() 
    207207{ 
    208     return (Thread* )TlsGetValue(Win32ThreadPrivateData::TLS.getId()); 
     208    DWORD ID = Win32ThreadPrivateData::TLS.getId(); 
     209    if (ID == TLS_OUT_OF_INDEXES) 
     210        return 0; 
     211    return (Thread* )TlsGetValue(ID); 
    209212} 
    210213 
  • OpenSceneGraph/trunk/src/OpenThreads/win32/Win32ThreadPrivateData.h

    r9832 r10635  
    7272        DWORD getId() 
    7373        { 
    74             static bool initialized = false; 
    7574            if (!initialized) { 
    7675                ID = TlsAlloc(); 
     
    7978            return ID; 
    8079        } 
     80        TlsHolder() : ID(TLS_OUT_OF_INDEXES), initialized(false) {} 
    8181        ~TlsHolder(){ 
    82             TlsFree(ID); 
     82            if (initialized) 
     83                TlsFree(ID); 
     84            ID = TLS_OUT_OF_INDEXES; 
    8385        } 
    8486    private: 
    8587        DWORD ID; 
     88        bool initialized; 
    8689    }; 
    8790