class T
{
public:
T();
virtual ~T();
void PrintF(CString str) {
CSingleLock cs(&this->m_cCritical); // Unhandled exception
happened here.
...
}
protected:
CCriticalSection m_cCritical;
}

In the file globals.cpp, I have

T t;

Then when I call t.PrintF(str) from the OnTimer method in the view
class,
"Unhandled Exception..." occured where the CSingleLock is instantiated.
If I create another T object before t, then everything is ok. Is it because
I'm
trying to use a MFC object inside a generic class? If I derived class T
from CObject, then
everything is ok too.

Andy