×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    99

    IAPConnect example

    i copied out the engine class in IAPConnect example into a new project and when i run, it shows error and exits the program at SetConnectionPreferences at iPref = pref.

    Below is the code:

    void CGPRSconnectEngine::SetConnectionPreferences(TInt aBearer, TBool aDialog, TUint32 aIapId)
    {

    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;

    pref.iRanking = 1;
    pref.iDirection =ECommDbConnectionDirectionOutgoing;
    aDialog ? pref.iDialogPref = ECommDbDialogPrefPrompt : pref.iDialogPref = ECommDbDialogPrefDoNotPrompt;

    CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer;
    bearer.iBearerSet = aBearer;
    bearer.iIapId = aIapId;
    pref.iBearer = bearer;

    iPref = pref; // <==== Error here
    }

    Does anyone know how to solve this? Thank you in advance.

  2. #2
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    99

    The error

    The error displayed is:

    Unhandled exception in epoc.exe (GPRSCONNECT.APP): 0xC0000005: Access Violation.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    Have you actually created the CGPRSconnectEngine instance using new(ELeave) (or calling a static function that does)?

    Lauri

  4. #4
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    99
    This is my constructor:

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

  5. #5
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    Yes, but do you call that NewLC() and then call that SetConnectionPreferences() member function on the returned instance?

    Lauri

  6. #6
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    99
    No. I just call it like that:

    iEngine -> SetConnectionPreferences(...);

    Do i need to create a new instance of it?

  7. #7
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    Of course! If you have a CGPRSconnectEngine* iEngine declaration in your class, it merely says that iEngine is a pointer to a CGPRSconnectEngine. It does not initialize the pointer. You'll need to allocate memory for the instance data (for example, iPref) with a call to NewLC. In your code, iEngine is a NULL pointer and the first attempt to indirect through it (accessing a member variable) will cause a KERN-EXEC 3 panic.

    Lauri

  8. #8
    Registered User
    Join Date
    Apr 2004
    Posts
    14
    Talking about the same example app, I also copied the engine and wait dialog code into my program. My app, as the exemple, doesn't terminate 'gracefully'. It shows a "Program closed" warning message...

    Do you know why?

    btw, I'm developing with sdk 1.2 and nokia 7650.

    regards
    Mário Afonso

  9. #9
    Regular Contributor
    Join Date
    Sep 2003
    Posts
    169

    IAPConnect example

    Hey,

    Maybe youi didn't destroy all the objects or something like that so the program crashes on exit.

    Regards, Aljaz

  10. #10
    Registered User
    Join Date
    Apr 2004
    Posts
    14
    Right.

    I found that the app terminates 'gracefully' on the device... but dont on the emulator. No problems then...

    regards
    M¨¢rio Afonso

Posting Permissions

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