×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    15

    exe - destructor not being called

    Hello,

    i have an server (exe) running in background waiting for events...
    i also have a started active scheduler in my exe...

    i have 2 questions:

    1.) When i stop (kill) the server from within my Application-UI (app) with the following code...
    then the destructor of the .exe is not being called!!! (but the exe is stopped, also not showing any mem-leaks on WINS,
    but i think there should be some if destructor not called)

    void CController::StopServer() {
    #ifdef __WINS__
    TFindThread finder;
    RThread server;
    #else
    TFindProcess finder;
    RProcess server;
    #endif
    TFullName fullName;
    while (finder.Next(fullName) == KErrNone) {
    TInt err = fullName.FindF(KServer);
    if (err != KErrNotFound) {
    TInt procErr = server.Open(finder);
    if (procErr == KErrNone) {
    server.Kill(KErrNone);
    server.Close();
    }
    }
    }
    }
    ...but: when i call CActiveScheduler::Stop() from the exe then the destructor is called.

    Can anybody please tell me why the destructor is not called???
    Do i have to implement client-server logic for achieving this?


    2.) My exe does some drawing on the phone´s idle screen.
    When the user switches off the phone the drawing maintains on the screen
    till the phone is completely switched off...
    I think the destructor is not being called as well...
    How can i detect if the phone is being switched off???

    i tried it with RSystemAgent: (without success)

    User::LeaveIfError(iSysAgent.Connect());
    iSysAgentEvent.SetRequestStatus(iStatus);
    iSysAgentEvent.SetUid(KUidPhonePwr);
    iSysAgent.SetEventBufferEnabled(ETrue);
    CActiveScheduler::Add(this);
    iSysAgent.NotifyOnEvent(iSysAgentEvent);
    SetActive();

    and if this event occurs, it should call the observer´s CActiveScheduler::Stop
    but it´s not being called...

    please can anyone help me...

    mike

  2. #2
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    79

    Re: exe - destructor not being called

    1) If you are killing you exe as process, then no destructor is called. Whole exe thread are terminated. That's all. When you call Stop(), then normal program closing occours.

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    15

    Re: exe - destructor not being called

    Thank you very much yavolinsky for immediate response!!

    mike

  4. #4
    Regular Contributor
    Join Date
    May 2004
    Location
    Bangalore, India
    Posts
    118

    Re: exe - destructor not being called

    Which Stop() you are talking about. RProcess doesnt have any Stop().

    Actually, I have an App (Exe for 3rd Edition) which runs in background. I am trying to kill it from other App. It kills the target App/Exe ( I cannot see in task list) but the destructor is never called. As a result of this, some resource handles hangs around. When I try to uninstall this app/exe, the installer fails to remove it saying "Unable to delete file".

    I am using N73 and I have PowerMgmt Capability and using following code to kill the app/exe.



    _LIT(KPttSMSNamePattern, "smsreceiver*");
    TFindProcess processKSMS(KPttSMSNamePattern);
    TFullName processKSMSName;
    while (processKSMS.Next(processKSMSName) == KErrNone)
    {
    RProcess OpenProcessSMS;
    TInt result = OpenProcessSMS.Open(processKSMS, EOwnerThread);

    if (result == KErrNone) //found a process
    {
    TExitType exittype=OpenProcessSMS.ExitType();

    if(exittype == EExitPending)
    {
    OpenProcessSMS.Terminate(0);
    }
    OpenProcessSMS.Close();
    break;
    }
    else
    {
    OpenProcessSMS.Close();
    }
    }
    Dushyant Gaur
    Sling Media,
    Bangalore
    cell:+91 9342276086
    email: dushyantg@slingmedia.com

  5. #5
    Regular Contributor
    Join Date
    May 2007
    Posts
    463

    Re: exe - destructor not being called

    Killing processes is never a good idea, you need to arrange a signal (IPC, P&S, etc.) to tell the server process to shut down gracefully.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

Similar Threads

  1. EXE run EXE
    By jend_rommel in forum Symbian
    Replies: 3
    Last Post: 2006-03-08, 01:48
  2. Replies: 10
    Last Post: 2006-02-28, 13:05
  3. Testing an EXE that looks for a file
    By ViruDoshi in forum Symbian
    Replies: 2
    Last Post: 2006-01-30, 10:52
  4. KERN EXE 3 panic in exe
    By santosh shetty in forum Symbian
    Replies: 3
    Last Post: 2006-01-11, 08:36
  5. Replies: 2
    Last Post: 2004-08-24, 20:04

Posting Permissions

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