diff options
author | Christopher Faylor <me@cgf.cx> | 2009-08-21 21:32:06 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2009-08-21 21:32:06 +0000 |
commit | 6282fe16ddf562366d87d7e23ba3b63413cb0218 (patch) | |
tree | d007b9daa192e004c18c86cb5185df3c12fd8f9d /winsup/cygwin/dll_init.cc | |
parent | e41f43a1a675ee6d0f21f2ab611c97ffe9c22088 (diff) | |
download | cygnal-6282fe16ddf562366d87d7e23ba3b63413cb0218.tar.gz cygnal-6282fe16ddf562366d87d7e23ba3b63413cb0218.tar.bz2 cygnal-6282fe16ddf562366d87d7e23ba3b63413cb0218.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/dll_init.cc')
-rw-r--r-- | winsup/cygwin/dll_init.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index 39a8f505b..f1b9a9f92 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -35,7 +35,7 @@ dll_global_dtors () dll_global_dtors_recorded = false; if (recorded && dlls.start.next) for (dll *d = dlls.end; d != &dlls.start; d = d->prev) - d->p.run_dtors (); + d->run_dtors (); } /* Run all constructors associated with a dll */ @@ -119,6 +119,7 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type) return d; /* Return previously allocated pointer. */ } + /* FIXME: Change this to new at some point. */ d = (dll *) cmalloc (HEAP_2_DLL, sizeof (*d) + (namelen * sizeof (*name))); /* Now we've allocated a block of information. Fill it in with the supplied @@ -126,6 +127,7 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type) d->count = 1; wcscpy (d->name, name); d->handle = h; + d->has_dtors = true; d->p = p; d->type = type; if (end == NULL) @@ -159,7 +161,7 @@ dll_list::detach (void *retaddr) system_printf ("WARNING: trying to detach an already detached dll ..."); else if (--d->count == 0) { - d->p.run_dtors (); + d->run_dtors (); d->prev->next = d->next; if (d->next) d->next->prev = d->prev; |