Skip to content

Commit

Permalink
Disable keepIsolateAlive on callables
Browse files Browse the repository at this point in the history
  • Loading branch information
simolus3 committed Dec 29, 2023
1 parent b62a3cd commit d703dca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions sqlite3/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.3.1-dev

- Set `NativeCallable.keepIsolateAlive` to `false` for callables managed by
this package.

## 2.3.0

- Add the `autocommit` getter on databases wrapping `sqlite3_get_autocommit`.
Expand Down
13 changes: 8 additions & 5 deletions sqlite3/lib/src/ffi/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ final class FfiDatabase extends RawSqliteDatabase {
}

final callable =
NativeCallable<Void Function(Pointer<Void>)>.isolateLocal(destroy);
NativeCallable<Void Function(Pointer<Void>)>.isolateLocal(destroy)
..keepIsolateAlive = false;
callables.add(callable);

return callable.nativeFunction;
Expand Down Expand Up @@ -696,7 +697,8 @@ extension on RawXFunc {
return NativeCallable.isolateLocal((Pointer<sqlite3_context> ctx, int nArgs,
Pointer<Pointer<sqlite3_value>> args) {
return this(FfiContext(bindings, ctx), _ValueList(nArgs, args, bindings));
});
})
..keepIsolateAlive = false;
}
}

Expand All @@ -707,7 +709,8 @@ extension on RawXFinal {
final res = this(context);
if (clean) context.freeContext();
return res;
});
})
..keepIsolateAlive = false;
}
}

Expand All @@ -727,7 +730,7 @@ extension on RawCollation {
return this(dartA, dartB);
},
exceptionalReturn: 0,
);
)..keepIsolateAlive = false;
}
}

Expand All @@ -743,7 +746,7 @@ extension on RawUpdateHook {
// happy.
return _returnsVoid();
},
);
)..keepIsolateAlive = false;
}

static void _returnsVoid() {}
Expand Down

0 comments on commit d703dca

Please sign in to comment.