Advertisement

05.09.2008 at 10:32PM PDT, ID: 23391321 | Points: 125
[x]
Attachment Details

Program Terminates / Crashes on cleanupstack::PushL() statement

Asked by cpumaster_2000 in C++ Programming Language, Symbian Handheld Operating System

Tags: Symbian C++, Carbide C++

I just decided I wanted to create programs for my nokia phone which uses symbian third

So i was going though a tutorial" Wiley - S60.Programming.A.Tutorial.Guide.Apr.2007" which seems to have errors in their code.. but anyway..

when i entered this example and ran it it jus exited prematurely. No reason nothing (i'm familiar with visual basic coding so the lack of an error message is very disconcerting. I then proceeded to debug and step though the program and every time it reaches the statement "CleanupStack::PushL(self);" in the NewLC function it just exits. I tried taking out the cleanupstack statements and it runs fine.
I'm using Carbide.c++ v1.3 and i placed the debugger in the text mode

i attached the code a part of the main which calls the NewL which calls the NewLC which is where it fails at the cleanupstack::PushL(self2); statementStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
LOCAL_C void MainL()
	{
	//
	// add your program code here, example code below
	//
	CCards* deckOfCards = CCards::NewL();
	TInt i, card;
	for (i=0; i<15; i++)
 
 
--------------------------------------------------------
#include "cards.h"
CCards* CCards::NewL()
	{
	CCards* self = CCards::NewLC();
	CleanupStack::Pop(self);
	return(self);
	}
 
CCards* CCards::NewLC()
	{
	CCards* self2 = new (ELeave) CCards();
	self2->ConstructL();
	CleanupStack::PushL(self2);
	return(self2);
	}
 
void CCards::ConstructL()
	{
	}
 
CCards::CCards()
	{
	for (TInt i=0; i<52; i++)
		iDeck[i] = i;
	}
 
Loading Advertisement...
 
[+][-]05.10.2008 at 01:46AM PDT, ID: 21538256

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628