Hi guys..

yes I did it again.

I overlocked a chunk but can't find the mistake.

The problem is that the error occurs only every 13. time I'm running my
program.
I know that you can only lock a chunk 13 times, but I thought that the OS
woul free all chunks that had been used by an application when this
application
is closed.

So probably I forgot to unlock a chunk somewhere, but I can't find this
chunk (after
having looked for it for about 13 hours)

Is there any possibility to show me the number of locks of a chunk?

Ok, here is another problem, in the following code that should iterate
through my
database I can put MemHandleUnlock(recordH) in the first position (which
doesn't make
any sense, but it works) but I can't put it into the second position. If I
write it there, the emulator
just crashes with the message "Free Handle"

Any help?

Many thanks, Dyk


 for (recordNeuNum = 0; recordNeuNum < numRecordsNeu; recordNeuNum ++)
{
      DmSeekRecordInCategory(gVeranstaltungNeuDB, &recordNeuIndex, 0,
       dmSeekForward, dmAllCategories);

       recordH  = DmQueryRecord (gVeranstaltungNeuDB, recordNeuIndex);
        if (!recordH)
        {
              FrmCustomAlert(MyAlert, "Problem beim Auslesen der neuen DB!",
"", "");
             err = DmGetLastErr();
             break;
        }
        else
        {
                pointer_auf_neue_v= (Veranstaltung_neu *)
MemHandleLock(recordH);
              neueVeranstaltung = * pointer_auf_neue_v;

            / /  ### Position 1 for #######   MemHandleUnlock(recordH);

          // delete all old records.
          TimSecondsToDateTime (TimGetSeconds (), &dateTime);

          todayInt =  ( ((Int32) dateTime.year-1904) << 16) +
               ( ((Int32) dateTime.month) << 8) +
                ((Int32) dateTime.day);

          dateInt =  ( ((Int32) pointer_auf_neue_v->datum_jahr) << 16) +
                  ( ((Int32) pointer_auf_neue_v->datum_monat) << 8) +
                  ((Int32) pointer_auf_neue_v->datum_tag);


          if (todayInt > dateInt)
          {
                   err = DmDeleteRecord(gVeranstaltungNeuDB,
recordNeuIndex);
                   deletedOldRecordsNum ++;
                  // ### Position 2 for ###########
MemHandleUnlock(recordH);
               continue; // -> jump to the next record
             }

           // so now, every record is in the future..

           // do some stuff with this record
           MemHandleUnlock(recordH)
      }

} // next in loop



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

Reply via email to