rdmenezes / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

Synchronization Issue in CCrashHandler #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Shouldn't CCrashHandler::m_ThreadExceptionHandlers be protected with a
critical section?

Original issue reported on code.google.com by skyew...@gmail.com on 18 Dec 2009 at 6:54

GoogleCodeExporter commented 9 years ago
You are right, its members should be protected. If someone tries to access 
members of
CCrashHandler::m_ThreadExceptionHandlers from main thread and from worker 
thread at
the same time, the app may crash. 

I plan to include this fix into v.1.2.1.

Original comment by zexspect...@gmail.com on 19 Dec 2009 at 4:11

GoogleCodeExporter commented 9 years ago
I reviewed the code another time...

Actually the members of CCrashHandler::m_ThreadExceptionHandlers shouldn't be
protected, because they are accessed from one thread only (from the thread that
installed exception handlers). Each thread accesses its own exception handlers 
by its
thread ID in 

std::map<DWORD, _cpp_thread_exception_handlers> m_ThreadExceptionHandlers;

However there is a danger that two threads will install exception handlers
concurrently and add items to the  m_ThreadExceptionHandlers at the same time. 
This
may cause crash. So, access to m_ThreadExceptionHandlers must be synchronized, 
I agree.

Original comment by zexspect...@gmail.com on 19 Dec 2009 at 4:25

GoogleCodeExporter commented 9 years ago
Fixed in v1.2.1

Original comment by zexspect...@gmail.com on 23 Dec 2009 at 7:08