×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Switzerland
    Posts
    61

    Unhappy App panics when deleting messages in inbox

    Hi all!

    Got a bit of a sticky problem. Here's the deal:

    I have an exe running in the background which monitors the global inbox for new messages. When a message with a certain type of content arrives, I do some manipulation with the contents and then I want to delete the message from the inbox (using CMsvEntry::DeleteL).

    Now, this all seems to work fine when I have only one or two messages in the inbox. The problems start when there are 3 or more messages of my type in the inbox.
    As my app handles them one by one, and then deletes them the "X new messages" system dialog keeps popping up with each delete, and somewhere around the 3rd or 4th delete operation my app panics with KERN-EXEC 3.

    Now, if I close the popups as soon as they appear (ie fast enough so that it's gone before the next delete operation) I don't get this crash, so it would seem as if the message server gets confused when a popup is being displayed for a message that has been deleted.

    Does anyone have any clues on how I could get round this problem? Is there some way to suppress those popups?

    Any info at all would be greatly appreciated!

    Cheers,
    Bjorn

  2. #2
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Hi,

    Though i can't help you in anyway,i just want to know how did you made the .exe running in the background?Have you derived the class from CServer ?

    Please let me know how could you achieve that...

    BR,

  3. #3
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Switzerland
    Posts
    61
    Hi, no I didn't derive from CServer since I have no need of communicating with a client app. I just made a normal CBase derived class with one static method to set up the trap handler,
    install an active scheduler and instantiate the class. I call this static method from E32Main() (the exe entry point).

    Bjorn

  4. #4
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Thanks for prompt reply.

    I have made an .exe which listens for the incoming Bluetooth connections but the problem is that the .exe doesn't wait until any remote device connects.

    How can i make the .exe run in the background? How did u able to accomplish that?

    BR,

  5. #5
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Switzerland
    Posts
    61
    It's not too difficult. The basics of my app looks like this (I've cut away most of the details as they are not relevant):

    // Header file defining the server class
    class CMyserver : public CBase, public MMsvSessionObserver
    {
    public:
    static TInt ThreadFunction(TAny* sStarted);
    static CMyServer* NewLC();
    ~CMyServer();
    void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);

    private:
    CPgcRouterServer();
    void ConstructL();
    static void ThreadFunctionL();

    private:
    CMsvSession* iSession;
    CMsvEntry* iEntry;
    };

    // implementation
    TInt E32Main()
    {
    return CMyServer::ThreadFunction(NULL);
    }

    void CMyServer::ThreadFunctionL()
    {
    // Construct active scheduler
    CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
    CleanupStack::PushL(activeScheduler) ;

    // Install active scheduler
    // We don't need to check whether an active scheduler is already installed
    // as this is a new thread, so there won't be one
    CActiveScheduler::Install(activeScheduler);

    // Construct our server
    CMyServer::NewLC();

    // Start handling requests
    CActiveScheduler::Start();

    CleanupStack::PopAndDestroy(4, activeScheduler);
    }

    TInt CMyServer::ThreadFunction(TAny* /*aNone*/)
    {
    CTrapCleanup* cleanupStack = CTrapCleanup::New();
    if (cleanupStack == NULL)
    {
    User::Panic(KMyServer, ECreateTrapCleanup);
    }

    TRAPD(err, ThreadFunctionL());
    if (err != KErrNone)
    {
    User::Panic(KMyServer, err);
    }

    delete cleanupStack;
    cleanupStack = NULL;

    return KErrNone;
    }

    CMyServer* CMyServer::NewLC()
    {
    CMyServer* self = new (ELeave) CMyServer();
    CleanupStack::PushL(self) ;
    self->ConstructL() ;
    return self;
    }

    CMyServer::~CMyServer()
    {
    // clean up
    }

    CMyServer::CMyServer()
    {
    }

    void CMyServer::ContructL()
    {
    iSession = CMsvSession::OpenAsyncL(*this);
    }

    void CPgcRouterServer::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/)
    {
    // handle event from message server
    .
    .
    .
    }

    --------------------------

    Basically this is all you need. Of course, my app listens to events from messaging server, but you should be able to fit in your bluetooth waiting code in there I think. You may want to derive CMyServer from CActive if you've got an async wait for bluetooth connection (not sure as I haven't used bluetooth myself).

    Hope that helps!
    Cheers,
    Bjorn

  6. #6
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Switzerland
    Posts
    61
    Still having problems with this. Managed to get around the crash by deleting all the messages in one go (using DeleteL with a CMsvEntrySelection), but now, after I've deleted the messages, and I'm waiting for the next this is what happens:
    the message comes in, I handle the EMsvEntriesCreated event (saving the TMsvId) and then the EMsvEntriesChanged comes in.
    Here, I call CMsvEntry::SetEntryL with the new message ID, and I get a KERN-EXEC 3!

    Funny thing is, if I start up the server again, it works perfectly after this. It also works perfectly if I've only handled one message (ie one message comes in, I handle it and delete it). The crash only comes after I've deleted multiple messages and a new message comes in. Anyone got any ideas?
    I'd be most grateful for any info!

    Cheers,
    Bjorn

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    Not really sure if it matters, but have sometimes had problems on deleting multiple instances on loop.

    Basically when doing deletion in loop, if you start with first, and delete it, then the indexing could make the second item to be now first, so when you move forwrd, you'll index gets out of scope. Basically to workaround this, is to start deleting in reverce order. Anyway, can not remember if this would have anything to do with message deletion, but still a point to think about.


    yucca

Posting Permissions

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