Closed jonasmalacofilho closed 7 months ago
Should we should check if val_db(r->database) == NULL since the database might have been closed in the meanwhile
@ncannasse maybe, where exactly do you mean?
One thing I noticed is that free_db
will set r->done
early on, and that cleanly stops result_next
. In fact, that's why we had no exception or segfault even though the db had been closed and freed.
I was told to merge this!
In the SQLite CFFI library,
connect
returns an abstract Neko value, ofk_db
kind and with a finalizer set. If thek_result
request value only keeps a pointer to the db struct, instead of the correspondingk_db
value, the finalizer will be called as soon as no other external references remain to that connection, even if the request itself is still reachable.The issue could manifest in code like (Haxe):
Related: HaxeFoundation/haxe#8728