SDAC 4.50: Access Violation in ClearTransactionRefs

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 7
Joined: Wed 09 Jul 2008 12:18

SDAC 4.50: Access Violation in ClearTransactionRefs

Post by Alan009 » Thu 31 Jul 2008 10:34

Sometimes I get Access Violation in TCustomDAConnection.ClearTransactionRefs when I try to free TCustomMSConnection class.
Method TCustomDAConnection.Destroy calls TCustomDAConnection.Destroy, which at first calls Disconnect, which causes the first call of TCustomDAConnection.ClearTransactionRefs. The first call works fine and calls successfully FTransactions.FreeITransaction for the single item of FTransactions list.
After that TCustomDAConnection.Destroy calls FreeITransactions, which causes the second call of TCustomDAConnection.ClearTransactionRefs. Now strange things begin to happen. It seems to me, that FTransactions list is already destroyed, but the value of FTransactions is not set to NIL, so the call to FTransactions.Count in ClearTransactionRefs can return any random value (if not causes access violation). So, when FTransactions.Count returns non zero value, ClearTransactionRefs tries to call FTransactions.FreeITransaction again, but Access Violation exception is raised, when trying to get the first element of FTransactions list (FTransactions.FITransaction).
The error can be reproduced, if the time period between the two calls to ClearTransactionRefs is small. When the program waits on a breakpoint after the first call for a long time (for a 30 sec for example), the second call to ClearTransactionRefs is usually successful.


SDAC 4.50
Windows XP SP2
MS SQL Server 2005
Delphi 7

Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 08 Aug 2008 07:24

We could not reporduce this problem. The FTransactions object is freed after all calls to ClearTransactionRefs. Do you use the TMSTransaction component in you project? If it is possible compose a small sample and send it to sdac*devart*com.

Post Reply