commit b80bab35b8f1538cc0e1070526402631f55df0a4 parent bfb0dbac56e9ec0a594cf3a8a8bc1559273edf8d Author: William Casarin <jb55@jb55.com> Date: Fri, 26 Jan 2024 10:57:50 -0800 ndb: fix crash with Ndb garbage collection on de-init Diffstat:
M | nostrdb/Ndb.swift | | | 12 | +++++++++++- |
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/nostrdb/Ndb.swift b/nostrdb/Ndb.swift @@ -448,7 +448,17 @@ class Ndb { } deinit { - self.close() + //print("txn: Ndb de-init close") + // + // DO NOT CLOSE IN DESTRUCTOR! Destructor deinit is clearly + // not reliable, since it seems to be getting called more than + // once when we have a few references to the database. + // + // Not sure if this is indicitable of a larger problem but I've + // experienced nothing but hell when relying on de-init for + // global resources. Free them manually. + // + // EVIL --> self.close() <-- EVIL } }