- priority: 5 --> 6
- assigned_to: nobody --> artee
- status: open --> open-accepted
When using the same database in several connections,
the reference count is not increased for subsequent
uses. This means that the first connection to stop using
the database gives the corresponding DatabaseInfo
object free. All other uses of the connection (e.g. in other
threads) then crash because the shared critical section
for the database is gone.
The problem can be fixed in passqlite.pas in TLiteDB.Use
by changing the handling when a database already exists
(beginning on line 716):
FActive := (Database<>'');
Result := FActive;
if Result then begin
FBaseInfo:= TBaseInfo(DataBases.
Objects[DataBases.IndexOf(DataBase)]);
>>> Inc( FBaseInfo.ReferenceCount );
end else
FBaseInfo := nil;
The crucial line to add is marked with >>>.
passqlite3 suffers from the same problem and can be
fixed similarly on line 353.