Re: Strange member pointer error - even the debugger is confused.
From: CheckAbdoul (checkabdoul)
Date: 07/12/04
- Next message: Alexander Nickolov: "Re: Which interfaces should be referenced in coclass definition of idl file?"
- Previous message: Igor Tandetnik: "Re: How to check from destructor whether it was called due to exception or normal exit from the scope?"
- In reply to: Aaron Lawrence: "Strange member pointer error - even the debugger is confused."
- Next in thread: a l: "Re: Strange member pointer error - even the debugger is confused."
- Reply: a l: "Re: Strange member pointer error - even the debugger is confused."
- Reply: Aaron Lawrence: "Re: Strange member pointer error - even the debugger is confused."
- Reply: Aaron Lawrence: "Re: Strange member pointer error - even the debugger is confused."
- Reply: Aaron Lawrence: "Re: Strange member pointer error - even the debugger is confused."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Jul 2004 12:11:52 -0400
Initialize m_pHead in your constructor to NULL. Something like
CGeneric::CGeneric(....)
{
m_pHead = NULL;
}
0xCDCDCDCD is a debugging value that comes from C runtime library. Take
a look at
http://www.microsoft.com/msj/1198/c/c1198.aspx
--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------
"Aaron Lawrence" <aaronlNO@SPAMintegration.co.nz> wrote in message
news:%23524UbCaEHA.1248@TK2MSFTNGP11.phx.gbl...
> Hi all,
>
> This may not exactly be a language problem but I couldn't find a
> .compiler group.
>
> We have a pretty typical COM object, whose declaration starts
>
> class ATL_NO_VTABLE CIfsf :
> public CComCoClass<CIfsf, &CLSID_Ifsf>,
> public IDispatchImpl<IPumpDriver, &IID_IPumpDriver, &LIBID_IFSFLib>,
> public CGeneric
> {
>
> which was made with the ATL COM AppWizard.
>
> Class CGeneric is declared:
>
> class CGeneric :
> public CComObjectRootEx<CComMultiThreadModel>
> ...
> protected:
> TBuff* m_pHead ;
>
>
> the problem is that the code is seeing different values (addresses
> pointed at) of m_pHead, depending on whether it is accessed in CGeneric
> or in CIfsf. For instance, code in the CGeneric constructor initialises
> it to NULL, but later code in CGeneric sees it as non NULL.
>
> Why is that?
>
> I am sure that there is only the one declaration of m_pHead.
>
> The debugger only sees one value, the same as what code in CIfsf sees,
> when I step through it ... even stepping through the code which is in
> CGeneric (see screenshot attached). This implies it isn't confusion over
> C++ usage, to me.
>
> I've recompiled from scratch many times, and in the debug build there is
> no optimisation of course.
>
> This occurs even in the same thread (the application is multithreaded,
> but my test case isn't).
>
> I am kind of confused. What should I look for?
>
> Strangely, many other COM objects built on the same base CGeneric class
> work fine. Which in turn implies that it's just a matter of compiler
> settings, but I can't see anything obvious.
>
> The environment is VC6, SP6 on Windows 2000, SP3.
>
> ANY suggestions would be most welcome!
>
> Thanks
>
> Aaron
>
>
----------------------------------------------------------------------------
----
- Next message: Alexander Nickolov: "Re: Which interfaces should be referenced in coclass definition of idl file?"
- Previous message: Igor Tandetnik: "Re: How to check from destructor whether it was called due to exception or normal exit from the scope?"
- In reply to: Aaron Lawrence: "Strange member pointer error - even the debugger is confused."
- Next in thread: a l: "Re: Strange member pointer error - even the debugger is confused."
- Reply: a l: "Re: Strange member pointer error - even the debugger is confused."
- Reply: Aaron Lawrence: "Re: Strange member pointer error - even the debugger is confused."
- Reply: Aaron Lawrence: "Re: Strange member pointer error - even the debugger is confused."
- Reply: Aaron Lawrence: "Re: Strange member pointer error - even the debugger is confused."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|