A question about User::Exit()

Login to reply to this topic.
Mon, 2004-12-06 08:48
Joined: 2004-08-09
Forum posts: 4
Hi all,

I am working together with a team of about 10 developers at a fairly large
Symbian application. The main view of the app has no CBA, only a menu in
the form of a list box (which contains, among other options, an Exit
option). TO make the story short, I've noticed that in the handling of
that Exit option, User::Exit(0) is called. I've read about User::Exit() in
the docs and I can say I'm really confused right now. In the docs it says
that all the resources of the current thread are cleaned up and the thread
is terminated. Indeed, when I exit from this app, there are no leaks and
it exits nicely. Also, none of the destructors are called.

So I wanted to ask when is it appropiate to call this method? I mean, this
seems like the "Holy Grail" of all C++ developers, some sort of a
primitive garbage collector. Why should I write destructors and close
RFs's, when I can simply call User::Exit() at the end and the system will
automagically take care of everything for me?

Are there any Symbian docs that explain this issue? (BTW, I don't know if
it's relevant, but I'm using the Nokia SDK, v. 1.2).

Of course, I've tried to do "the right thing", so instead of calling
User::Exit(), I am calling ProcessComandL(EEikCmdExit) on the app ui.
However, it fails with KERN-EXEC 3, (I've imagined there will be a lot of
leaks, but this KERN EXEC took me by surprise). I've debugged it (I am
using Visual Studio 6.0) and when I am stepping out from the destructor of
the AppUi I am getting this unhandled exception in CONE <some address>.

So if you have any idea what might be wrong, please help me.

Regards!

Sun, 2005-06-05 13:14
Joined: 2005-01-07
Forum posts: 41
Re: A question about User::Exit()
question: did you ever figure this out?

i am also getting a KERN-EXEC 3 after the ~AppUi destructor, and have no idea what can be causing it ??

Memory leaks are usually KERN-EXEC 0's anyways, and for the life of me i can't figure out why a KERN-EXEC 3 ?? Dereferenced pointer AFTER the ~AppUI?? what pointer is that, and (since it's obviously not in my control), how to avoid it?

Thanks,
Mon, 2005-06-06 13:49
Joined: 2004-05-20
Forum posts: 22
Re: A question about User::Exit()
Please use the Exit() method of the appui class.
Tue, 2005-06-07 06:22
Joined: 2004-07-12
Forum posts: 90
Re: A question about User::Exit()
KERN-EXEC 3 is for null pointer error, maybe double deletion? And pls, use sdk help, it will describe all the common panics and more. only thing you have to do is to search for it.

savaaZ

For quality Symbian idling, join #symbian at irc.freenode.net

Fri, 2005-06-10 09:52
Joined: 2005-01-07
Forum posts: 41
Re: A question about User::Exit()
As my question indicates, i know from the sdk(and yes, i consult it before posting: always.) kern-exec 3 is "most likely" pointer double deletion.

the question was why this was happening *after* the ~appui destructor.

turns out, i was calling AddView() in the constructor (which transfers ownership!!) for each of my views, and doing a delete of the views myself in ~appui. The kern-exec 3 was occuring (outside my code) because the framework was also later calling delete on my views (of which he owned a pointer).

I read the SDK before posting, and knew what a kern-exec 3 was.
The SDK, however, did NOT indicate any transfer of ownership for AddView(), and *should* imho.

thanks for the tips though

(and as far as i know, Exit() is not meant to be used in the destructor of AppUI, but rather to call it Wink
Fri, 2005-06-10 10:28
Joined: 2005-03-15
Forum posts: 94
Re: A question about User::Exit()
Savaaz posted it just two days ago. Same problem of double deletion due to ownership transfer upon calling AddViewL().

http://forum.newlc.com/index.php/topic,8175.0.html


Vivek


Vivek Chopra

Sat, 2005-06-11 23:38
Joined: 2005-01-07
Forum posts: 41
Re: A question about User::Exit()
i know, it was my question he answered Smiley

my reply below was to "close" this thread for future reference, i should have mentionned it instead of just using the past tense Smiley

cheers,
/Luc.
  • Login to reply to this topic.