From 6282fe16ddf562366d87d7e23ba3b63413cb0218 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 21 Aug 2009 21:32:06 +0000 Subject: * dll_init.h (has_dtors): New flag. (run_dtors): New wrapper function which avoids calling dtors more than once. * dll_init.cc (dll_global_dtors): Use dll.run_dtors wrapper. (dll_list::detach): Ditto. (dll_list::alloc): Set has_dtors flag. --- winsup/cygwin/dll_init.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'winsup/cygwin/dll_init.h') diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h index 9a712a3cc..90cfa03e2 100644 --- a/winsup/cygwin/dll_init.h +++ b/winsup/cygwin/dll_init.h @@ -50,10 +50,19 @@ struct dll per_module p; HMODULE handle; int count; + bool has_dtors; dll_type type; WCHAR name[1]; void detach (); int init (); + void run_dtors () + { + if (has_dtors) + { + has_dtors = 0; + p.run_dtors (); + } + } }; #define MAX_DLL_BEFORE_INIT 100 -- cgit v1.2.3