From d9de45ac3fffd9affa059d7404234f79ba00dfae Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 19 Apr 2021 11:03:35 -0400 Subject: ext-dep: d2sqlite3 updated --- .../d2sqlite3/source/d2sqlite3/internal/memory.d | 29 +++++++++------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'src/ext_depends/d2sqlite3/source') 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); } -- cgit v1.2.3