Shakh
User
 Fresh Boarder
| Posts: 8 |   | Karma: 0 |
|
Re:AdQuery.Delete fails
|
|
Posted: 2007/06/21 13:12 |
|
|
|
|
I've could not reproduce it in a demo application
Here is the trace
I start the trace from here (*) tracing TADDatSRow object for being valid at place (1)
procedure TADDatSRow.AcceptChanges(AUseCascade: Boolean = True);
...
rsDeleted:
begin
oList := RowList;
if oList <> nil then
(*) oList.Remove(self);
end;
...
(1)if DBLockID <> 0 then
DBUnlock;
end;
|
As we trace into oList.Remove(self) we shell come to TADDatSRow.Destroy (ANotDestroy is False by default)
Here is call stack
TADDatSRow.Destroy
TADDatSRowListWithAggregates.RemoveAt(???,???)
TADDatSTableRowList.RemoveAt(???,???)
TADDatSList.Remove(???,True)
TADDatSRow.AcceptChanges(???)
TADDAptTableAdapter.ProcessUpdate($2EAE5B8,eaApplied,arUnlock,[uoImmediateUpd,uoNoSrvRecord],[],-1)
TADDAptTableAdapter.Update(???,eaApplied,???,arUnlock)
TADCustomTableAdapter.UnLock(???,???,[uoImmediateUpd,uoNoSrvRecord])
TADAdaptedDataSet.DoProcessUpdateRequest(???,[uoDeferedLock,uoNoSrvRecord..(out of bound) 7])
TADDataSet.InternalDelete
|
So at (1) we have invalid reference - Self is already Destroyed
If check is done - i.e.
...
b := True;
case RowState of
...
if oList <> nil then
begin
oList.Remove(self);
b := False;
end;
...
if b then
if DBLockID <> 0 then
DBUnlock;
|
Then neither error nor memory leak is reported
|
|