×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    10

    Exception raised when cancelling timer

    Hi folks.

    I am attempting to create an active object that is driven by a timer. The code successfully starts the timer, processes the timeouts then restarts the timer. However if I attempt to cancel the timer emulator halts with the statement "Suspended: Signal 'Exception 5' received. Description Access Violation.". Although I have implemented a DoCancel() member, the function is not invoked.

    I would be very grateful if any one can provide an explaination for this behaviour.

    I am developing for S60, Symbian 8.1, Carbide 1.1.


    The class is invoked with:
    iTimer1 = CTimeWatch::NewL();
    iTimer1->StartTimerL(10000000);

    and I am attempting to cancel the timeout with
    iTimer1->Cancel();


    The code for the class is:

    class CTimeWatch: public CActive
    {
    public:
    static CTimeWatch * NewL(void);
    ~CTimeWatch (void);
    void StartTimerL(TTimeIntervalMicroSeconds32& aInterval);

    private:
    void ConstructL(void);
    CTimeWatch (void);

    void RunL(void);
    void DoCancel(void);
    TInt RunError(TInt aError);

    private:
    RTimer iRTimer;
    TTimeIntervalMicroSeconds32 iInterval;
    };

    CTimeWatch::CTimeWatch(void)
    : CActive (EPriorityStandard)
    {
    CActiveScheduler::Add(this);
    }

    CTimeWatch* CTimeWatch::NewL()
    {
    CTimeWatch* self = new (ELeave) CTimeWatch();
    self->ConstructL();
    return self;
    }

    void CTimeWatch::ConstructL(void)
    {
    User::LeaveIfError (iRTimer.CreateLocal());
    }

    CTimeWatch::~CTimeWatch(void)
    {
    Cancel();
    iRTimer.Close();
    }

    void CTimeWatch::StartTimerL(TTimeIntervalMicroSeconds32& aInterval)
    {
    iInterval = aInterval;
    iRTimer.After (iStatus, aInterval);
    SetActive();
    }

    void CTimeWatch::RunL()
    {
    iRTimer.After (iStatus, iInterval);
    SetActive();
    }

    void CTimeWatch:oCancel()
    {
    iRTimer.Cancel();
    }

  2. #2
    Regular Contributor
    Join Date
    Nov 2005
    Location
    Aalborg, Denmark
    Posts
    296

    Re: Exception raised when cancelling timer

    You code looks perfectly fine to me - so my only suggestion would be to check the surrounding code and maybe test it on a device..

  3. #3
    Regular Contributor
    Join Date
    Nov 2005
    Location
    Aalborg, Denmark
    Posts
    296

    Re: Exception raised when cancelling timer

    I just tried you code on my machine and it works fine without any problems.. So I guessing the issues must be somewhere else..

  4. #4
    Registered User
    Join Date
    Feb 2007
    Posts
    10

    Re: Exception raised when cancelling timer

    Mollevp.

    Thanks for that rapid response. I'm going to try the test app on a phone later today. Meanwhile I'm just checking the harness to see if that is causing the problem.

    Dave

Similar Threads

  1. When can you set the screensaver's Refresh Timer Value?
    By azhrei in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2008-08-23, 10:12
  2. VS.Net 2003 Carbide 2.01 and epoc32.exe
    By ValentinK in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-01-12, 12:31
  3. How to get info on raised Exception?
    By addicted in forum Mobile Java General
    Replies: 0
    Last Post: 2006-01-19, 13:48
  4. Timer delay between playbacks???
    By lalitsharma in forum Symbian
    Replies: 3
    Last Post: 2005-09-09, 11:45
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

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