×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    3

    KErrBadDescriptor while Doing an IPCRead , Commserver Panic 4 Please Help

    Hi
    I am writing an .CSY .
    Problem description is as follows .
    There is a class derived from CPort . Whenver a client to Cport ( in this case hci.dll) is issuing a request to Write ( i.e. RComm::Write) , then StartWrite of my derived class( from CPORT) is called .

    in StartWrite i am doing an IPCREAD() to get data.

    In doing IPCRead i am getting a Panic ( Commserver panic 4 i.e. KErrBadDescriptor).

    Code is attached here


    void CCodRealport::StartWrite()
    {


    if(iSendBuf->Length() < length)
    {
    RDebug::Print(_L("[VSP] ProcessWrite Reallocating to len = %d"),length);
    TInt res = KErrNone;
    HBufC8* tmpBuffer = NULL;
    TRAP(res, tmpBuffer = iSendBuf->ReAllocL(length));

    if (tmpBuffer == NULL || res != KErrNone)
    {
    RDebug::Printf("[VSP] CCodRealPort::RunL , no memory available ");
    return;
    }

    }
    iSendBufPtr.Set(iSendBuf->Des());

    IPCRead(aClientBuffer, iSendBufPtr); }

    iSendBuf is an HBufC* and iSendBufPtr as an TPtr8 type .
    Both of them are members of class CcodRealPort .

    Also this problem is not persistent . A very intersting and probably confusing observation is :- This problem occurs only when we press keypad .

    I am using Symbian OS 9.3 !! Please Help.

  2. #2
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: KErrBadDescriptor while Doing an IPCRead , Commserver Panic 4 Please Help

    You're using a pointer (iSendBuf) that's been potentially changed after doing a realloc. Check the sdk doc for the proper use of ReAllocL()

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    3

    Re: KErrBadDescriptor while Doing an IPCRead , Commserver Panic 4 Please Help

    First of all thanks for replying

    Sorry i missed one line while copying ( this problem had made me lousy)
    here is the updated one .
    if(iSendBuf->Length() < length)
    {

    TInt res = KErrNone;
    HBufC8* tmpBuffer = NULL;

    TRAP(res, tmpBuffer = iSendBuf->ReAllocL(length));

    if (tmpBuffer == NULL || res != KErrNone)
    {
    RDebug::Printf("[VSP] CCodRealPort::RunL , no memory available ");
    return;
    }

    iSendBuf = tmpBuffer; // i missed this line
    }

    SDK says that ReallocL deletes previous buffer and gives back new buffer pointer .
    Here i am assigning new buffer pointer to tempbuffer and as iSendBuf is of no use i am reassigning it to tempbuffer

    iSendBufPtr.Set assigns new pointer ( after realloc) to iSendbufPtr .

    after doing all these things i don't iSendBufPtr is using wrong descriptor
    suggestions are invited

  4. #4
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: KErrBadDescriptor while Doing an IPCRead , Commserver Panic 4 Please Help

    Well, then one other possible reason you could check in your code would be using automatic vars in async calls.

Similar Threads

  1. KErrBadDescriptor while Doing an IPCRead , Commserver Panic 4
    By anubhavg in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2009-01-15, 11:56
  2. Using Bluetooth serial port in MIDlets (nokia 9500 issue)
    By orsteglasy in forum Mobile Java Networking & Messaging & Security
    Replies: 11
    Last Post: 2007-10-07, 21:49
  3. Panic dialog - ERRRD
    By greatape in forum Symbian
    Replies: 7
    Last Post: 2007-09-16, 19:32
  4. CEikProgressInfo & PANIC when setting wrong width and final val
    By eekisa in forum Symbian User Interface
    Replies: 2
    Last Post: 2006-01-05, 13:26
  5. Replies: 0
    Last Post: 2004-09-24, 22:01

Posting Permissions

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