Well, I have found the problem at last! And I would categorize it as an OS bug.

When creating the popup trigger (say object index x) and the associated list (object index x + 1) dynamically, the Palm OS creates a third object (object index x + 2). This third object must be removed before removing the list and trigger to avoid any errors.

If you look at the popup list creation process in PilRC, you will see a POPUPLIST object is needed as well and that object binds the trigger and the list together. The same thing happens here, but the only difference is that the third object is created by the OS internaly. However, probably it is not removed by the OS resulting in the crashes I reported earlier.

Damn Plam OS!... just kidding :). I feel so good today; I spent about 7 weeks to find out the solution for this problem.

Thanks everyone.

Regards,
Jenni

----- Original Message ----- From: "Jennifer Fell" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, October 28, 2004 9:03 AM
Subject: Re: problems with FrmRemoveObject



I recently mentioned about having problem with FrmRemoveObject when removing dynamically created popup lists. I thought it would be btter if I also mention where exactly it crashes: it is the PrvOffsetPtrIfNeeded function I suppose.

Here is the call stack:
FrmRemoveObject
 - PrvMoveFormInternals
   -PrvRewireForm
     -PrvRewireForm
       -PrvOffsetPtrIfNeeded // HAVING PROBLEM

Thanks,
Jenni

----- Original Message ----- From: "Jennifer Fell" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, October 25, 2004 3:08 PM
Subject: problems with FrmRemoveObject



Here is a piece of code which gets executed when removing a object that has a number of popup lists. These lists are dynamically created in that object's constructor function. Anyway, this FrmRemoveObject crashes in some specific situations. I know it's impossible to tell what's going on without looking at the codes, but still I wonder if anybody can guess what could possibly cause this problem. FYI,

for (i = TOTAL_LISTS - 1; i >= 0; i--) {

   lstId = popupLists[i].lstId;
   objId = FrmGetObjectIndex (frmP, lstId);
   FrmHideObject (&frmP, objId);
   FrmRemoveObject (&frmP, objId);            //CRASHES HERE

   ctlId = popupLists[i].ctlId;
   objId = FrmGetObjectIndex (frmP, ctlId);
   FrmHideObject (&frmP, objId);
   FrmRemoveObject (&frmP, objId);
}

Thanks,
Jenni


Just in case you are curious about the construction process, here is a portion of the constructor function where I am creating the object (there mightbe some typo errors):


lastRsrcId = 2000;
for (i = 0; i < TOTAL_LISTS; i++) {

   if (!CtlNewControl ((void**)&frmP, ++lastRsrcId,
                                  popupTriggerCtl, NULL,
                                  0, 0, maxWidth, 0,
                                  stdFont, NULL, true) {
        ErrDisplay ("Memory ERROR!");
        return;
   }
   popupLists[i].ctlId = lastRsrcId;

if (LstNewList ((void**)&frmP, ++lastRsrcId,
0, 0, maxWidth, 0, stdFont, 3,
popupLists[i].popupBox[popupBox].ctlId)) {
ErrDisplay ("Memory ERROR!");
return;
}
popupLists[i].lstId = lastRsrcId;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/



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



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

Reply via email to