summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-22 19:43:27 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-22 19:43:27 +0000
commit8f383343763451bc2ec6d921230cd74cba66c687 (patch)
tree700a56f1839927ca984c08e54562bdacd88d23ea /libstdc++-v3
parentc0baf7dea21ae49d302e2fa94210787a560336b4 (diff)
downloadgcc-8f383343763451bc2ec6d921230cd74cba66c687.tar.gz
PR libstdc++/57914
* libsupc++/atexit_thread.cc (run): Delete cleanup elts. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201146 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/libsupc++/atexit_thread.cc19
2 files changed, 20 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index cd87d948487..879fd617aeb 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-22 Jason Merrill <jason@redhat.com>
+
+ PR libstdc++/57914
+ * libsupc++/atexit_thread.cc (run): Delete cleanup elts.
+
2013-07-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57920
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index 3b33df233e8..11f1dbdeac4 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -58,8 +58,13 @@ namespace {
void run (void *p)
{
elt *e = static_cast<elt*>(p);
- for (; e; e = e->next)
- e->destructor (e->object);
+ while (e)
+ {
+ elt *old_e = e;
+ e->destructor (e->object);
+ e = e->next;
+ delete (old_e);
+ }
}
// Run the stack of cleanups for the current thread.
@@ -67,9 +72,15 @@ namespace {
{
void *e;
if (__gthread_active_p ())
- e = __gthread_getspecific (key);
+ {
+ e = __gthread_getspecific (key);
+ __gthread_setspecific (key, NULL);
+ }
else
- e = single_thread;
+ {
+ e = single_thread;
+ single_thread = NULL;
+ }
run (e);
}