ResetAndDestroy leaves?

Login to reply to this topic.
Sun, 2005-02-06 15:03
Joined: 2005-01-31
Forum posts: 33
Hi,

I have the following code in one of my classes definition:
class A {
...

typedef TBufC<MAX_LOG_OP_NAME> TOpName;
typedef struct {
  TOpName m_opName;
  TTime m_timeStarted;
} OpInfoStruct;
      
typedef CArrayPtrFlat<OpInfoStruct> OpInfoArray;
OpInfoArray m_operations;

....
};

In ~A() I call m_operations.ResetAndDestroy() which leaves unexpectedlly (I get the App closed message).

Any ideas?
Thanx
Yaron Tadmor

Sun, 2005-02-06 17:39
Joined: 2004-09-25
Forum posts: 75
Re: ResetAndDestroy leaves?
Quote from: yaront
...
In ~A() I call m_operations.ResetAndDestroy() which leaves unexpectedlly (I get the App closed message).

Any ideas?
Thanx
Yaron Tadmor

It's very unlikely that ResetAndDestroy leaves, because it doesn't end with L. What you are experiencing is probably a Panic, not a Leave. There are many reasons why it could panic. Most likey, that's double deallocation. Knowing the panic number/category would help. Check debug output from the emulator.

-Slava
Mon, 2005-02-07 08:51
Joined: 2003-12-05
Forum posts: 586
ResetAndDestroy leaves?
Have you allocated your OpInfoStruct objects dynamically?
Wed, 2005-02-09 19:35
yarontt (not verified)
Forum posts: 2019
ResetAndDestroy leaves?
Found the problem.
CArrayPtrFlat is derived from CBase and A is not. CArrayPtrFlat, assumes CBase operator new will zero it's memory.

I changed m_operations to be a pointer member and it's ok now.
  • Login to reply to this topic.