• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 74570d65266a04f1cb95ff778759fa540afe92a4 Mon Sep 17 00:00:00 2001
2From: David 'Digit' Turner <digit@android.com>
3Date: Sun, 20 Feb 2011 20:54:32 +0100
4Subject: Work-around for Android __cxa_finalize bug
5
6Change-Id: I82364f6ed1ca04ecf3844179bc9887f61226fd75
7---
8 gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc |    8 ++++++++
9 gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc   |    8 ++++++++
10 2 files changed, 16 insertions(+), 0 deletions(-)
11
12diff --git a/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc b/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc
13index 63f46a9..845b6d1 100644
14--- a/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc
15+++ b/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc
16@@ -101,6 +101,14 @@ struct __eh_globals_init
17
18   ~__eh_globals_init()
19   {
20+    /* Work-around for an Android-specific bug, where this destructor
21+     * is called with a NULL object pointer. This is due to a bug in the
22+     * __cxa_finalize() implementation that was only fixed in 2.2.
23+     */
24+#ifdef __ANDROID__
25+    if (this == NULL)
26+        return;
27+#endif
28     if (_M_init)
29       __gthread_key_delete(_M_key);
30     _M_init = false;
31diff --git a/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc b/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc
32index 63f46a9..845b6d1 100644
33--- a/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc
34+++ b/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc
35@@ -101,6 +101,14 @@ struct __eh_globals_init
36
37   ~__eh_globals_init()
38   {
39+    /* Work-around for an Android-specific bug, where this destructor
40+     * is called with a NULL object pointer. This is due to a bug in the
41+     * __cxa_finalize() implementation that was only fixed in 2.2.
42+     */
43+#ifdef __ANDROID__
44+    if (this == NULL)
45+        return;
46+#endif
47     if (_M_init)
48       __gthread_key_delete(_M_key);
49     _M_init = false;
50--
511.7.6.rc0
52
53