×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    103

    How to close CMsvStore ?

    i create a message in outbox using smtpmtm ,
    SmtpMtm->CreateMessageL(TMsvId id);

    then i get the TMsvEntry from smtpmtm and set the required values in it and
    SmtpMtm->SwitchCurrentEntryL(message.Id());
    SmtpMtm->AddAddresseeL(_L("u@ok.com"));
    SmtpMtm->SetSubjectL(_L("subject"));
    SmtpMtm->SaveMessageL();
    then i get CMsvEntry& from smtpmtm as
    CMsvEntry& entry = SmtpMtm->Entry();

    on this entry object i open the store for editing ,set the richtext type message body and commit

    the store.

    entry.SetEntryL(message.iServiceId);


    NOW WORKING WITH ABOVE LINES WHILE I CHANGE THERE POSITION UP AND DOWN TO MAKE THE CODE WORK I

    GET ONE OF THE FOLLOWING ERRORS , THAT SAYS THE CMSVSTORE WAS NOT CLOSED , NOW CAN SOME ONE TELL

    ME HOW DO I CLOSE THE CMSVSTORE OBJECT.


    Category: MSGS
    251
    CMsvEntry object destroyed with associated message store left open
    259
    CMsvEntry::SetEntryL() called with associated message store left open
    261
    Client attempts to open already open message store through CMsvEntry

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    17

    Re: How to close CMsvStore ?

    Did you ever figure this out I am running into the same problem

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: How to close CMsvStore ?

    Hi All am also experiencing the same problem.

    Debug error:
    Main [Thread id: 748] (Suspended : Error - Thread 0x2ec has panicked. Category: MSGS; Reason: 251)
    [Unknown] at 0x8045ce28
    [Unknown] at 0x8046914e

    Could someone please assist?
    Last edited by KnowledgeSeeker; 2012-08-15 at 09:18.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,174

    Re: How to close CMsvStore ?

    Quote Originally Posted by KnowledgeSeeker View Post
    Hi All am also experiencing the same problem.

    Debug error:
    Main [Thread id: 748] (Suspended : Error - Thread 0x2ec has panicked. Category: MSGS; Reason: 251)
    [Unknown] at 0x8045ce28
    [Unknown] at 0x8046914e

    Could someone please assist?
    You are likely using very different devices & SDKs than was used original query, since this thread has not been active for over 7 years now. In future you should not open old threads like this, but simply make a new thread for your problem.

    anyway, you might want to explain on which device you are experiencing the problem, also you should say what it is that you are trying to do with the code.

    and lastly, do include the code segment that is giving the error.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: How to close CMsvStore ?

    This panic is still related to the store, "EMsvStoreLeftOpenOnDestruction2=251" says MsvPanic.h.
    CMsvStore object is closed via deletion. So make sure that you delete it before you delete the related CMsvEntry object.

  6. #6
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: How to close CMsvStore ?

    Hi Gentlemen,

    Thank you for your responses;

    I'm still a bigginer in Symbian C++. and I'm trying to delete a specific sms in the sentBox msg folder. am not too sure of the syntax and thefore not too sure where I might be going wrong

    Here is what I've done so far, but I still get the same error:

    Code:
    void CSmsHandler::DeleteMessages() 
    {
    
    	HBufC* SMSContent = HBufC::NewLC(400);
    	//HBufC* SMSContent8 = HBufC::NewLC(400);
    
    	CMsvStore* sentboxStore;
    	
    	TMsvSelectionOrdering sort;
    	sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries
     
    	CMsvEntry* sentboxContext=CMsvEntry::NewL(*iSession,KMsvSentEntryId,sort);
    	CleanupStack::PushL(sentboxContext);
     
    	CMsvEntrySelection* entries = sentboxContext->ChildrenL();
    	CleanupStack::PushL( entries );
    
    	TInt msgCount= entries->Count();
    	TInt i;
    	for (i=0; i <= msgCount; i++)
    	{
    		TMsvId entryID = entries->At(i);
    		iSmsMtm->SwitchCurrentEntryL(entryID);
     
    		CMsvEntry* entry= iSession->GetEntryL((*entries)[i]);
    		CleanupStack::PushL(entry);
    		  /* Skip loop if fail in obtains the message store */
    				TRAPD(r, sentboxStore = entry->ReadStoreL());
    		 
    				if(KErrNone != r)
    				{
    					CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    																							note->ExecuteLD(_L("Error Accessing inbox")); 	
    					CleanupStack::PopAndDestroy(entry);
    					continue;
    					
    					
    				}
    		 
    		
    				if (sentboxStore->HasBodyTextL())
    				{
    					CRichText& richText= iSmsMtm->Body();
    					sentboxStore->RestoreBodyTextL(richText);
    								const TInt length = richText.DocumentLength();
    					 
    					                   
    								SMSContent->Des().Copy(richText.Read(0,3)); 
    							
    								_LIT(KText1, "???");
    								TBufC16<3> buf11(KText1);
    								HBufC* buf1 = buf11.AllocLC();
    		
    								TInt res = buf1->Compare(SMSContent->Des());
    
    								
    								CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    								note->ExecuteLD(_L("Eveluating message: ")); 	
    							
    								CEikonEnv::Static()->AlertWin(*SMSContent); //Alert window..
    								
    								if (res == 0)
    								{
    									
    									CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    																		note->ExecuteLD(_L("DeletingMessage")); 
    																		
    																		//CleanupStack::PopAndDestroy(2,entry);
    																			
    																		//	CleanupStack::PopAndDestroy(4,SMSContent);
    																			
    																			//CleanupStack::PopAndDestroy(SMSContent);
    																			//CleanupStack::PopAndDestroy(buf1);
    																			//CleanupStack::PopAndDestroy(res);
    													
    																			//CleanupStack::PopAndDestroy(sentboxStore);	
    																		//delete sentboxStore;							
    								entry->DeleteL(entryID);
    								
    								CleanupStack::PopAndDestroy(sentboxStore);
    								CleanupStack::PopAndDestroy(entry);
    								
    								}
    								richText.Reset();
    					
    				}
    				else
    				{
    				// no text in SMS 
    					CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    																							note->ExecuteLD(_L("NO Text")); 	
    				}
    	}
    	CleanupStack::PopAndDestroy(entries);
    	CleanupStack::PopAndDestroy(sentboxContext);
    }
    Last edited by wizard_hu_; 2012-08-16 at 13:24.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: How to close CMsvStore ?

    sentboxStore is not deleted properly. There seem to be a "delete sentboxStore;" line, but it is commented in the code. Also note that sentboxStore is not on the Cleanup Stack, so the PopAndDestroy(sentboxStore) would die even if the code reaches that line.

  8. #8
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: How to close CMsvStore ?

    Hi,

    Thanks i've added the delete sentboxStore line and the first issue is solved. I'm able to delete the msg.

    I've bee struggling with the following error now for a while:

    debug error:
    Main [Thread id: 859] (Suspended : Error - Thread 0x35b has panicked. Category: E32USER-CBase; Reason: 90)
    [Unknown] at 0x8045ce28
    [Unknown] at 0x8046914e

    I Know its got to do with an expected popanddestroy not meeting the criteria.

    so I added:

    //code:
    CleanupStack::PopAndDestroy(4,SMSContent);
    //code:

    before the following lines:
    CleanupStack::PopAndDestroy(entries);
    CleanupStack::PopAndDestroy(sentboxContext);

    But I still get the same error.

    the application deletes the maching sms. which works fine.

    But now the problem is that I get the above error ( E32USER-CBase; Reason: 90) when the application runs normally (without any matching smses to delete).

    Could you please assist with the structuring of my pop and destroy functionality?


    and also I'm not sure what the '4' means in the following line of code: "CleanupStack::PopAndDestroy(4,SMSContent);", could you please also explain this to me?

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: How to close CMsvStore ?

    It is documented both in the SDK Help and the on-line library (http://library.developer.nokia.com/i...tackClass.html, you may have to open the link twice in order to get the 'real' page)
    The 4 is the number of elements you are removing from the Cleanup Stack. The pointer you specify (like SMSContent) is the element you expect to be removed last.
    The Cleanup Stack is a stack, so you always put/remove elements on/from the top of it. If you specify a number to PopAndDestroy, you remove multiple elements. If you specify an object, that is a verification, you say you expect that element to be removed.

  10. #10
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: How to close CMsvStore ?

    Hi wizard,

    Thank you very much your input is really helping a lot. my cleanup stack issues are also now resolved. My main issue now is exceptions. For me this is more of a tool problem.

    I'm using Carbide as my IDE. I'm having trouble targeting the specific line of code that is giving the exception?

  11. #11
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,174

    Re: How to close CMsvStore ?

    Quote Originally Posted by KnowledgeSeeker View Post
    Hi wizard,

    Thank you very much your input is really helping a lot. my cleanup stack issues are also now resolved. My main issue now is exceptions. For me this is more of a tool problem.

    I'm using Carbide as my IDE. I'm having trouble targeting the specific line of code that is giving the exception?
    You might want to explain the problem in more details, currently its pretty hard to figure out what you are experiencing there.

  12. #12
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: How to close CMsvStore ?

    I was getting a 'data abort exception'. But I managed to resolve it. I looks like it was caused by an unexpected input into the popandDestroy method.

    Thank you guys.

    My App Works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×