@Чебурашка:
I am not 100% convinced that the problem is in the sqlite components/package implementation.
It might be intended behaviour but I do not know.
That question should probably be answered by someone who implemented the classes.
At least opening the library in the main program thread solves your issue, so that is a relative easy fix do you agree ?
The problem is related to the libsqlite3.so load/unload mechanism, that makes use of RefCount and InterlockedIncrement. I don't know exactly why but this is what happens when, like me one creates and destroys the connection obejcts every time they are used (btw it is not enough to create/destroy the connection obecjt, also Connected := True is necessary, because you have to go though the DoInternalConnect/DoInternalDisconnect couple).
The idea of keeping a connection created and opened is
just a ugly workaround because I happened to come across this problem just because my threads are doing free wheel operations, but having threads doing operations just seldom does only make more unlikely the problem to happen, which is even worse because one can have an AV in just one year of execution and that would be extremely difficult to interpret (like all the concurrence problems of the world).