Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User autumnsea's Avatar
    Join Date
    Sep 2006
    Posts
    21
    I am using CMsvEntry and encountering some problem.


    CMsvEntry * iMsvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalOutBoxIndexEntryId, TMsvSelectionOrdering());

    CleanupStack::PushL(iMsvEntry);

    //if I put CleanupStack::PopAndDestroy(iMsvEntry); nothing wrong

    iMsvEntry=iSession->GetEntryL(aId);

    CleanupStack::PopAndDestroy(iMsvEntry);//But if I put the code here an

    Access Violation occurs, could any please tell me why? How I can destroy
    this object? I've been looking for solutions for a day. Thank you

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,747
    Quote Originally Posted by autumnsea
    CMsvEntry * iMsvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalOutBoxIndexEntryId, TMsvSelectionOrdering());
    CleanupStack::PushL(iMsvEntry);
    iMsvEntry=iSession->GetEntryL(aId);
    CleanupStack::PopAndDestroy(iMsvEntry);
    In the last line, you verify, if top of the Cleanup Stack contains the pointer returned by iSession->GetEntryL(aId) (since iMsvEntry contains this value). However the topmost entry of the Cleanup Stack contains a pointer referring the object created by CMsvEntry::NewL(...). Since the two (expected and actual) are not equal, you get the panic.

  3. #3
    Registered User autumnsea's Avatar
    Join Date
    Sep 2006
    Posts
    21
    Oh thank you for the kind reply . So should I drop either of the two lines?
    But what if the code does not work?

  4. #4
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,747
    Quote Originally Posted by autumnsea
    So should I drop either of the two lines?
    I do not know, it highly depends on what you want to achieve.
    But what if the code does not work?
    Fix it, this is the common way

  5. #5
    Super Contributor Paul.Todd's Avatar
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644
    The problem is not with the cleanupstack, its with your c++..


    You create a new instance of a CMsvEntry and put it on the cleanupstack

    you then replace it with the value returned from GetEntry

    You then remove it from the cleanup stack but use the value from GetEntry and not the one you allocated with NewL

    CMsvEntry* aaaaa = CMsvEntry::NewL(*iSession, KMsvGlobalOutBoxIndexEntryId, TMsvSelectionOrdering());
    CleanupStack::PushL(aaaaa);
    CMsvEntry* iMsvEntry=iSession->GetEntryL(aId);
    CleanupStack::PopAndDestroy(aaaaa);

  6. #6
    Registered User autumnsea's Avatar
    Join Date
    Sep 2006
    Posts
    21
    Thank you for the timely reply

    I know what the problem is now. I am still not very familiar with the SMS yet, maybe C++ inclusive

    But here is another problem:

    I wrote some code (as the 'SMS Example' and the 'SMSSend' example) to send SMSes automaticly, but once the problem has sent two or more messages, when closing the program there will be memory leakage. I will cannot figure out what is wong. If I remove the InvokeAsynFunctionL() from the SendL(), I can call SendL() twice with out problem. Is there something I need to pay attention to on this function?

    Thank you.

    Enrique
    Last edited by autumnsea; 2006-10-08 at 16:47.

Similar Threads

  1. Replies: 2
    Last Post: 2007-10-05, 20:40
  2. CMsvEntry object creation error -46 !
    By navjotsingh1979 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-09-25, 07:56
  3. CMsvEntry object creation error -46 !
    By navjotsingh1979 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-09-23, 19:37
  4. Replies: 2
    Last Post: 2003-09-01, 22:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved