sqlite: throw on disposal of an in-use session

Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65449
Fixes: https://github.com/nodejs/node/issues/65447
Refs: https://github.com/nodejs/node/pull/65349
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
This commit is contained in:
Guilherme Araújo authored and GitHub committed 2026-08-28 09:26:48 +00:00
1 parent 28b571c38a
commit 2743045dc4
3 files changed
+48 -22

No files matched your search

+10 -5
View File
@@ -4350,12 +4350,17 @@ void Session::Close(const FunctionCallbackInfo<Value>& args) {
session->Delete();
}
void Session::Dispose(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch(args.GetIsolate());
Close(args);
if (try_catch.HasCaught()) {
CHECK(try_catch.CanContinue());
void Session::Dispose(const FunctionCallbackInfo<Value>& args) {
Session* session;
ASSIGN_OR_RETURN_UNWRAP(&session, args.This());
Environment* env = Environment::GetCurrent(args);
if (session->session_ == nullptr) {
return;
}
THROW_AND_RETURN_ON_BAD_STATE(
env, session->is_generating_changeset_, "session is currently in use");
session->Delete();
}
void Session::Delete() {