Would it be possible to "enhance" Aurelius.Drivers.SQLite.Import
, Line 244:
FROM
procedure FinalizeSQLiteUnit;
begin
if LibraryHandle <> 0 then
FreeLibrary(LibraryHandle);
end;
TO
procedure FinalizeSQLiteUnit;
begin
if LibraryHandle <> 0 then begin
FreeLibrary(LibraryHandle);
LibraryHandle := 0;
f_sqlite3_close := nil;
end;
end;
And Aurelius.Drivers.SQLite.Classes
, Line 83
FROM
destructor TSqliteDatabase.Destroy;
begin
if FHandle <> nil then
f_sqlite3_close(FHandle);
inherited;
end;
TO
destructor TSqliteDatabase.Destroy;
begin
if (FHandle <> nil) and Assigned(f_sqlite3_close) then
f_sqlite3_close(FHandle);
inherited;
end;
The reason for this request is ... in an application where I have a object whose life is controlled by RTTI approaches (actually, I meant RemObjects CodeFirst Remoting SDK). That object will be destroyed upon a RTTI method's owning unit unloading.
Then I have the problem - the unloading order is not known apriori - thus it is possible that Aurelius.Drivers.SQLite.Import.pas
might have been unloaded before TSqliteDatabase.Destroy
is called.
The modified code adds extra protection, and doesn't change the semantics of the original code.
@wlandgraf Would it be possible that you might consider incorporate the changes?