Click here to Skip to main content
15,920,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Permutations with repetition Pin
CPallini8-Apr-10 3:25
mveCPallini8-Apr-10 3:25 
QuestionCFile Dialog Crash on Window Server 2008. Pin
Le@rner5-Apr-10 18:22
Le@rner5-Apr-10 18:22 
AnswerRe: CFile Dialog Crash on Window Server 2008. Pin
KarstenK5-Apr-10 22:42
mveKarstenK5-Apr-10 22:42 
GeneralRe: CFile Dialog Crash on Window Server 2008. Pin
Le@rner7-Apr-10 20:49
Le@rner7-Apr-10 20:49 
GeneralRe: CFile Dialog Crash on Window Server 2008. Pin
KarstenK7-Apr-10 22:38
mveKarstenK7-Apr-10 22:38 
QuestionStack overflow Pin
browneyes865-Apr-10 16:00
browneyes865-Apr-10 16:00 
QuestionRe: Stack overflow Pin
David Crow5-Apr-10 16:31
David Crow5-Apr-10 16:31 
AnswerRe: Stack overflow Pin
Luc Pattyn5-Apr-10 16:52
sitebuilderLuc Pattyn5-Apr-10 16:52 
GeneralRe: Stack overflow Pin
Tim Craig5-Apr-10 18:20
Tim Craig5-Apr-10 18:20 
GeneralRe: Stack overflow Pin
Luc Pattyn5-Apr-10 18:31
sitebuilderLuc Pattyn5-Apr-10 18:31 
GeneralRe: Stack overflow Pin
Luc Pattyn5-Apr-10 18:31
sitebuilderLuc Pattyn5-Apr-10 18:31 
GeneralRe: Stack overflow Pin
CPallini5-Apr-10 21:27
mveCPallini5-Apr-10 21:27 
GeneralRe: Stack overflow Pin
Tim Craig6-Apr-10 8:31
Tim Craig6-Apr-10 8:31 
GeneralRe: Stack overflow Pin
CPallini6-Apr-10 9:23
mveCPallini6-Apr-10 9:23 
AnswerRe: Stack overflow Pin
Adam Roderick J5-Apr-10 19:02
Adam Roderick J5-Apr-10 19:02 
QuestionRe: Stack overflow Pin
browneyes867-Apr-10 4:27
browneyes867-Apr-10 4:27 
AnswerRe: Stack overflow Pin
jagadish bharath7-Apr-10 5:42
jagadish bharath7-Apr-10 5:42 
QuestionRe: Stack overflow Pin
browneyes867-Apr-10 5:55
browneyes867-Apr-10 5:55 
AnswerRe: Stack overflow Pin
jagadish bharath7-Apr-10 7:18
jagadish bharath7-Apr-10 7:18 
Questiondelete breaking heap [modified] - solved Pin
PaulowniaK5-Apr-10 15:21
PaulowniaK5-Apr-10 15:21 
Thanks to everyone who tried to help out.
Sorry, my bad, this was a red herring.
I found out that I was overrunning an array because the spec of other parts of the software had changed without my knowledge.
I've increased the memory allocation accordingly, and it is fine now.

==================================================================

I'm having trouble with destructors and delete.

I have some embedded structure so in order to delete one of my objects, I have to call lots of desctructors in a hierarchical way:

void CMyBigClass::StartKilling()
{
	if(NULL != m_pSubObject1)
	{
		delete m_pSubObject1;
		m_pSubObject1 = NULL;
	}
}
...

CSubObject1::~CSubObject1()
{
	if(NULL != m_pSubObject2)
	{
		delete m_pSubObject2;
		m_pSubObject2 = NULL;
	}
}
...

CSubObject2::~CSubObject2()
{
	if(NULL != m_pSubObject3)
	{
		delete m_pSubObject3;
		m_pSubObject3 = NULL;
	}
}


Normally, if I set a break point on the
delete m_pSubObject1;

line and step in (F11), I land in the first line of the desctructor fo CSubObject1.

However, I jump straight to
delete m_pSubObject3;

where I get a heap error.

I looked into as much as I could, and the debugger isn't lying. The memory it is trying to delete is different from what I told it to delete. Something is trampling over the memory, but I don't know what. I don't know how to find out either.

I've undone all the changes since the last time it was working, but still the same problem.

Please, someone, tell me how to find out what's gone wrong!!
Almost, but not quite, entirely unlike... me...
modified on Tuesday, April 6, 2010 3:16 AM

AnswerRe: delete breaking heap Pin
Adam Roderick J5-Apr-10 19:03
Adam Roderick J5-Apr-10 19:03 
AnswerRe: delete breaking heap [modified] Pin
Eugen Podsypalnikov5-Apr-10 20:22
Eugen Podsypalnikov5-Apr-10 20:22 
AnswerRe: delete breaking heap [modified] - solved Pin
Tim Craig6-Apr-10 8:34
Tim Craig6-Apr-10 8:34 
QuestionhInstance / Win32 Pin
Fareed Rizkalla5-Apr-10 6:19
Fareed Rizkalla5-Apr-10 6:19 
AnswerRe: hInstance / Win32 Pin
Chris Meech5-Apr-10 6:27
Chris Meech5-Apr-10 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.