> From: Elia [EMAIL PROTECTED]
>
> Hi all,
>
> I have an odd bug that seems to only affect my app on PalmOS2.0. It seems that when
>I
>
> attempt to select a new category, the chunk is being locked and not released. I can
>select new categories about 12-13 times before I max out and get a "chunk
>over-locked" error which crashes the application. I removed all of the additional
>function calls and have no records in the application database. I am calling the
>following function on a control select event for the category pop-up trigger:
>
>
> category = gPrefs.currCategory; // current category frmP = FrmGetActiveForm();
>categoryEdited = CategorySelect(gAppDBRef, frmP, MainCategoryPopTrigger,
>MainCategoryList, true, &category, gCategoryName, 1, AccountEditString);
>
>
> AccountEditString is in the resource as requested by OS. Does this not work in
>OS2.0. The docs seem to suggest it should.
>
Your code seems to be correct, assuming gCategoryName holds the correct
name
(ie, you did CategoryGetName(gAppDBRef, gPrefs.currCategory,
gCategoryName); somewhere before this block of code)
and gCategoryName is a char array of size dmCategoryLength.
Also, I've not used the custom prompt (AccountEditString in your
example) much. It's possible that the call locks the resource, but does
not release it under 2.0
It is possible that you have an unrelated lock leak that's only
triggered under PalmOS 2.0.
You might want to rework the code a tad, just to see if it helps:
try 1 -- replace AccountEditString with 0 to use the default edit
string. If that fixes the problem, then you've just discovered a Palm OS
bug.
try 2 -- fetch the current category string each time:
Char CatName[dmCategoryLength];
Word category;
category = gPrefs.currCategory; // current category
CategoryGetName(gAppDBRef, category, CatName);
frmP = FrmGetActiveForm();
categoryEdited = CategorySelect(gAppDBRef, frmP, MainCategoryPopTrigger,
MainCategoryList, true, &category,
gCategoryName, 1, AccountEditString);
try 3 -- review all unrelated code to verify that you're unlocking every
chunk you lock ;)
--
John Schettino - http://members.tripod.com/schettino/
Author of Palm OS Programming For Dummies, CORBA For Dummies,
AppleScript Applications, and more.