|
|
User login
Feeds |
A question about User::Exit()
|
|||||
| Mon, 2004-12-06 08:48 | |
|
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! |
|
Forum posts: 41
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,
Forum posts: 22
Forum posts: 90
savaaZ
For quality Symbian idling, join #symbian at irc.freenode.net
Forum posts: 41
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
Forum posts: 94
http://forum.newlc.com/index.php/topic,8175.0.html
Vivek
Vivek Chopra
Forum posts: 41
my reply below was to "close" this thread for future reference, i should have mentionned it instead of just using the past tense
cheers,
/Luc.