skirmish76
asked on
Simple Unsolvable Problem - mtex.cpp(90)
I am working on a very large application that uses CMutex and CSingleLock for synchronisation. I am told that this code worked perfectly under VC++ 6 but since rolling over to .NET (2003) there are problems.
The program will go down because of an ASSERT in line 90 of mtex.cpp (one of the afx files I think). I've located this file and here is the relavent code:
CSingleLock::CSingleLock(C SyncObject * pObject, BOOL bInitialLock)
{
ASSERT(pObject != NULL);
ASSERT(pObject->IsKindOf(R UNTIME_CLA SS(CSyncOb ject))); //FAILS HERE
....
When this fires it appears that pObject passed to it appears to be a valid pointer to an object of type Win32ThreadResource which is one of our classes that inherits from CMutex (and doesn't appear to be more then a wrapper).
Anyway this code has worked for a very long time but under VS .NET it fires the above assert (then dies). Any ideas?
Adam
The program will go down because of an ASSERT in line 90 of mtex.cpp (one of the afx files I think). I've located this file and here is the relavent code:
CSingleLock::CSingleLock(C
{
ASSERT(pObject != NULL);
ASSERT(pObject->IsKindOf(R
....
When this fires it appears that pObject passed to it appears to be a valid pointer to an object of type Win32ThreadResource which is one of our classes that inherits from CMutex (and doesn't appear to be more then a wrapper).
Anyway this code has worked for a very long time but under VS .NET it fires the above assert (then dies). Any ideas?
Adam
ASKER
I added the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC macros as you suggested but the problems remains. Thanks for suggesting them though, I read the doco for them and they really did sound like they would solve the problem (seeing as the problem was an assertion failure of KindOf() ).
If you have any more ideas please post them. This problem continues to be extremely frustrating.
If you have any more ideas please post them. This problem continues to be extremely frustrating.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You need to have :
/* Win32ThreadResource .h */
class Win32ThreadResource : public CMutex
{
int num;
public:
DECLARE_DYNAMIC(Win32Threa
};
//==============
/* Win32ThreadResource .cpp */
#include "stdafx.h"
#include "Win32ThreadResource .h"
IMPLEMENT_DYNAMIC(Win32Thr