Discussion Board

Results 1 to 3 of 3
  1. #1
    Super Contributor
    Join Date
    Mar 2003

    DestroyDocument() is closing the calling app


    I'm porting a custom MTM project I have from 3rd edition to 2nd edition.

    The 3rd edition version uses RAknAppServiceBase/CAknAppServiceBase and CAknAppServer to launch the editor, but this is not available in 2nd edition. So instead I'm loading the editor as an embedded app from my "open editor" CMsvOperation.

    Here is the code to launch the editor (which is working properly as far as I can tell):
        CApaProcess* process=CEikonEnv::Static()->Process();
        // Add a new embedded document to the current process with the type of our viewer\editor app
        TFileName buffer = KViewEditAppFileName();
        CEikDocument* document=static_cast<CEikDocument*>(process->AddNewDocumentL(buffer));
        // Put this new document on the cleanup stack
        TApaDocCleanupItem cleanup(process, document);
        CleanupStack::PushL(cleanup); // push cleanup
        // Tell the document to initialise
        CleanupStack::Pop(); // cleanup
        iDocument = document;
        // restore document
        TPckgBuf<TEditorParameters> package(aParams);
        // Create a stream store, this could be on disk but here we are using an in-memory store
        CBufStore* store=CBufStore::NewLC(32);      // push store
        RStoreWriteStream outStream;
        TStreamId id=outStream.CreateLC(*store);      // push outStream
        CleanupStack::PopAndDestroy();      // pop outStream
        // Create a stream dictionary so we can find our parameters
        CStreamDictionary* dic=CStreamDictionary::NewLC();      // push dic
        dic->AssignL(TUid::Uid(0), id);
        outStream.CreateLC(*store);      // push outStream
        CleanupStack::PopAndDestroy();      // pop outstream
        // Tell the document to restore itself from this store
        RStoreReadStream readStream;
        readStream.OpenLC(*store, id);      // push readStream
        iDocument->RestoreL(*store, *dic);
        CleanupStack::PopAndDestroy(3, store);      //  readStream, dic, store
    The editor is opened and my message is loaded, no problems so far.

    I call iDoorObserver->NotifyExit() in the editor's AppUi destructor to let the calling app (the messaging app) know that it's finished, and in the CMsvOperation's destructor I have:
            CApaProcess* process=CEikonEnv::Static()->Process();
    But this always causes the messaging app to close too (instead of just my editor).

    If I don't call DestroyDocument() (even though the documentation says I <i>have to</i>) then I get back to the messaging app, but if I try to create/edit a message the messaging app closes down.

    I'm not getting any panics or other error messages (I have ErrRd).

    Any ideas on what I might be doing wrong? Or any examples I can look at other than the DocumentHandler example which wasn't much help?


    I just ran a little test on the phone where I added a call to User::Panic and I didn't get any error message (the messaging app just closed). So I am guessing that I'm causing a panic somehow. Is there anyway to get the panic messages to display? I'm using an N90.
    Last edited by shmoove; 2008-05-15 at 15:03.

  2. #2
    Super Contributor
    Join Date
    Mar 2003

    Re: DestroyDocument() is closing the calling app

    I just installed TaskSpy and found out I'm getting a KERN-EXEC 3.


  3. #3
    Super Contributor
    Join Date
    Mar 2003


    Found the problem:

    The editor was creating it's own instance of CMsvSession. This worked fine for 3rd edition because it runs in a separate process. But in 2nd edition the editor runs in the same thread as the MTM dlls. From the CMsvSession docs:
    Only a single session should be created within a thread.
    So I was messing up the message server session when deleting the editor's instance.


Similar Threads

  1. Replies: 1
    Last Post: 2007-11-23, 07:33
  2. Closing app from menu task + dialog
    By tektronic in forum Symbian
    Replies: 4
    Last Post: 2007-10-01, 19:04
  3. Replies: 3
    Last Post: 2003-06-24, 15:28
  4. calling the phone App
    By mwilliams45 in forum Mobile Java General
    Replies: 1
    Last Post: 2003-02-13, 07:54
  5. Launching an app from pJava..
    By krajag in forum PersonalJava
    Replies: 0
    Last Post: 2002-10-10, 19:57

Posting Permissions

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