File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Core/Libraries/Source/WWVegas/WWLib Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,15 @@ bool DbgHelpLoader::load()
6767 Inst = new (p) DbgHelpLoader ();
6868 }
6969
70- ++Inst->m_referenceCount ;
70+ // Always increment the reference count.
71+ const long referenceCount = InterlockedIncrement (&Inst->m_referenceCount );
7172
7273 // Optimization: return early if it failed before.
7374 if (Inst->m_failed )
7475 return false ;
7576
7677 // Return early if someone else already loaded it.
77- if (Inst-> m_referenceCount > 1 )
78+ if (referenceCount > 1 )
7879 return true ;
7980
8081 // Try load dbghelp.dll from the system directory first.
@@ -124,7 +125,7 @@ void DbgHelpLoader::unload()
124125 if (Inst == NULL )
125126 return ;
126127
127- if (-- Inst->m_referenceCount != 0 )
128+ if (InterlockedDecrement (& Inst->m_referenceCount ) != 0 )
128129 return ;
129130
130131 freeResources ();
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ class DbgHelpLoader
180180
181181 Processes m_initializedProcesses;
182182 HMODULE m_dllModule;
183- int m_referenceCount;
183+ Interlocked32 m_referenceCount;
184184 bool m_failed;
185185 bool m_loadedFromSystem;
186186};
Original file line number Diff line number Diff line change 3838
3939#if defined(_MSC_VER ) && _MSC_VER < 1300
4040typedef unsigned MemValueType ;
41+ typedef long Interlocked32 ;
4142#else
4243typedef unsigned long long MemValueType ;
44+ typedef volatile long Interlocked32 ;
4345#endif
You can’t perform that action at this time.
0 commit comments