DmResizeRecord() should fail (give a Fatal error msg)
if the record/handle is locked.
Danko Radic wrote:
>
> There were some words about handles thesedays, and I'd like to make
> something clear.
> When resizing record (DmResizeRecord) we should take (eventual) new handle
> into further processing for the reasons described in manual (it can change
> if there isn't enough space to do resizing etc.). Now, if I LOCK record's
> handle BEFORE resizing (do some operations on data) and then resize record
> and take new handle, what would happen with old handle when I call
> MemPtrUnlock (and then DmReleaseRecord)? If it wewen't changed by
> DmResize, it would be unlocked, but what would happen if it was?
>
> See the next example (I'll skip obvious declarations, it's just shematic
> example):
>
> error=DmFindRecordByID(sampleDB,uniqueID,&index);
> handle=MemHandleLock(DmGetRecord(sampleDB,index));
> ptr=LockDataPtr(SrcID);
>
> //...doing some things on data...
>
> handle=DmResizeRecord(sampleDB,index,size);
>
> MemPtrUnlock(ptr);
> DmReleaseRecord(sampleDB,index,true);
>
> Of course, it would be the best to unlock all and then do resizing, but
> what if I don't?
>
> Sorry for eventual mistyppos in the example above (I don't have manual
> or code right now) but I think you got the idea.