aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ext_depends/d2sqlite3/source
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2021-04-19 11:03:35 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2021-04-19 11:03:35 -0400
commitd9de45ac3fffd9affa059d7404234f79ba00dfae (patch)
tree8d1bc183a922b294537dcc4c086f955aecd99840 /src/ext_depends/d2sqlite3/source
parentorg-mode, cosmetic (diff)
ext-dep: d2sqlite3 updated
Diffstat (limited to 'src/ext_depends/d2sqlite3/source')
-rw-r--r--src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d b/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d
index 664dbdd..afc3a4b 100644
--- a/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d
+++ b/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d
@@ -66,22 +66,17 @@ extern(C) void releaseMem(const void* ptr)
// Adapted from https://p0nce.github.io/d-idioms/#GC-proof-resource-class
void ensureNotInGC(T)(string info = null) nothrow
{
- import core.exception : InvalidMemoryOperationError;
- try
- {
- import core.memory : GC;
- cast(void) GC.malloc(1);
+ import core.memory : GC;
+ import core.stdc.stdio : fprintf, stderr;
+ import core.stdc.stdlib : exit;
+
+ if (!GC.inFinalizer)
return;
- }
- catch(InvalidMemoryOperationError e)
- {
- import core.stdc.stdio : fprintf, stderr;
- import core.stdc.stdlib : exit;
- fprintf(stderr,
- "Error: clean-up of %s incorrectly depends on destructors called by the GC.\n",
- T.stringof.ptr);
- if (info)
- fprintf(stderr, "Info: %s\n", info.ptr);
- assert(false);
- }
+
+ fprintf(stderr,
+ "Error: clean-up of %s incorrectly depends on destructors called by the GC.\n",
+ T.stringof.ptr);
+ if (info)
+ fprintf(stderr, "Info: %s\n", info.ptr);
+ assert(false);
}