For me it seems that if you have both firstNameBuf and MobileNumber in CleanupStack, you are popping them in wrong order. CleanupStack is a stack which means that the last one going in has to be popped out first. So, you should change the order of those two calls to be:
if (firstNameBuf)
CleanupStack::PopAndDestroy(firstNameBuf);
CBase 90 actually tells this quite clearly: "The panic is raised as a result of a call to the Pop() and PopAndDestroy() static member functions of the CleanupStack class. The panic occurs when an the item to be popped is not the expected item."
Well, should have seen that myself, having checked the source code in this regard ....
rajeshpadhiary, if you could not tell the line with the error because you don't really debug, here my standard advice in this situation: Learn how to use emulator and debugger as soon as possible. You won't get very far without them.
Of course you are getting the panic there, since the iContactItem is not on the top of the cleanup stack but the MobileNumber variable.
You are misusing the cleanup stack big time here. You must make sure, considering the conditional blocks, that everything you push there will be popped out in the correct order. It's a cleanup stack dude. The last thing you push there, must be the one popped out next -- in all conditions, considering your conditional code (if sentences).
And pushing member variables to the cleanup stack is a huge mistake. If your iContactItem really is a member variable, as the name suggests (didn't bother to check) then you will have problems if the leave happens and you correctly delete iContactItem in the class destructor (you will have double delete resulting to a crash).
Forum posts: 1242
Why don't you debug and tell which line causes the error then?
Errors like that are so easy to find with the help of the debugger.
René Brunner
Forum posts: 20
in my apllications when dial number matches the ccontact database number ,iam display name in a note there i got error.
Forum posts: 1242
The line with the 'CMapUtil' call, is that the line with the error?
If yes, what's 'CMapUtil'? Who wrote that class?
By the way, it would be better to include smaller code samples directly in your post instead of using attachments.
René Brunner
Forum posts: 9
For me it seems that if you have both firstNameBuf and MobileNumber in CleanupStack, you are popping them in wrong order. CleanupStack is a stack which means that the last one going in has to be popped out first. So, you should change the order of those two calls to be:
if (firstNameBuf)
CleanupStack::PopAndDestroy(firstNameBuf);
if(MobileNumber)
CleanupStack::PopAndDestroy(MobileNumber);
CBase 90 actually tells this quite clearly: "The panic is raised as a result of a call to the Pop() and PopAndDestroy() static member functions of the CleanupStack class. The panic occurs when an the item to be popped is not the expected item."
Forum posts: 1242
Well, should have seen that myself, having checked the source code in this regard ....
rajeshpadhiary, if you could not tell the line with the error because you don't really debug, here my standard advice in this situation: Learn how to use emulator and debugger as soon as possible. You won't get very far without them.
René Brunner
Forum posts: 20
CleanupStack::PopAndDestroy(iContactItem); here iam getting error.
Forum posts: 672
Of course you are getting the panic there, since the iContactItem is not on the top of the cleanup stack but the MobileNumber variable.
You are misusing the cleanup stack big time here. You must make sure, considering the conditional blocks, that everything you push there will be popped out in the correct order. It's a cleanup stack dude. The last thing you push there, must be the one popped out next -- in all conditions, considering your conditional code (if sentences).
And pushing member variables to the cleanup stack is a huge mistake. If your iContactItem really is a member variable, as the name suggests (didn't bother to check) then you will have problems if the leave happens and you correctly delete iContactItem in the class destructor (you will have double delete resulting to a crash).