Multithreading and DirectX

Hello,

My app crashes in totaly unpredictable way. I used same code on old laptop and
I never had crash, but now I reinstalled evertything on new laptop, so could
it be something with incompatible DLL’s, since I am using SDL, DirectX, LUA. I
am using multithreaded debug dll configuration. I pruned my app, so now crash
happens in directx destruction, before I had global stl vector, which I did
not fill with anything (up to that point where it crashes) but on closing app
I get crash in stl vector destructor which is called atexit. Crash always
happened in global variables (multithreading problem?) until I pruned them all
of, now it happens inside singleton, on DX destruction. I am not creating any
new threads my self.

Break always happens in xmtx.c:
_RELIABILITY_CONTRACT
void __CLRCALL_PURE_OR_CDECL _Mtxlock(_Rmtx _Mtx)
{ /
lock mutex */
#ifdef _M_CEE
System::Threading::Thread::BeginThreadAffinity();
#endif
EnterCriticalSection(_Mtx);}

Any suggestions?