Hello all,
        I have the following function in a virtual driver:

static Err responseNotification(SysNotifyParamType *notifyParamsP)
{
    Err err;
    static UInt16 count = 0;

    notificationBufferP data =
(notificationBufferP)(notifyParamsP->notifyDetailsP);

    if (notifyParamsP->notifyType == kDrvrCreatorType && 
        notifyParamsP->broadcaster == kDrvrCreatorType)
    {
        LOG_PRINTF_F((data->globals->logInfoP, "  Sending: (%u)\n",
data->bufSize));
        LOG_DUMPASC_DS((data->globals->logInfoP, (UInt8*) data->buf,
data->bufSize));
        SrmSend(data->globals->portRef, (void *)data->buf,
(UInt32)data->bufSize, &err);
        MemPtrFree(data->buf);

        ((SysNotifyParamType *)notifyParamsP)->handled = true;

        LOG_PRINTF_F((data->globals->logInfoP, "Count = %u\n", count));

        if (count < 3)
        {
            // Reprime the wake up handler
            LOG_PRINTF_F((data->globals->logInfoP, "  repriming wakeup
handler\n"));
            err = SrmPrimeWakeupHandler(data->globals->portRef, 1);

            count++;
        }
        
    }
    return 0;
}

        The function is used to respond to a notification broadcast sent by
another part of my code.  The problem is that the function works fine
and all the variables check out in the network connection dialog box -
but when I go to an application that uses the serial manager the
function crashes.  Does this occure because the code has been moved and
the pointer has become invalid?

To help me figure this out I added the count variable so that it would
only get triggered the first time in the application (it gets triggered
twice immediately after connection).  The problem is that the count
variable gets logged as having strange random values in the thousands
and the if (count < 3) never gets entered.  The only way I can see this
happening is if the stack has been totally screwed by a mismatch in the
amount of data pushed on compared to the amount expected to be there. 
I'm guessing that the screwy stack could cause the count variable to be
refered to wrong - but then that would only mean the wrong place in
memory would be set to zero and then seen as zero . . . anyway back to
my point...

What could possibly be going wrong to cause this to happen?


Thanks in advance,
Craig.

--
Craig Jeffree                                   [EMAIL PROTECTED]
dotWAP.com Inc.                                   http://www.dotwap.com/
Melbourne, Australia

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to