1 From 27bb0310fa5989c26a2ba83d6efed441023b7230 Mon Sep 17 00:00:00 2001 2 From: David 'Digit' Turner <digit (a] android.com> 3 Date: Sun, 20 Feb 2011 20:54:32 +0100 4 Subject: [PATCH] Work-around for Android __cxa_finalize bug 5 6 Change-Id: I82364f6ed1ca04ecf3844179bc9887f61226fd75 7 --- 8 gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc | 8 ++++++++ 9 1 files changed, 8 insertions(+), 0 deletions(-) 10 11 diff --git a/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc b/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc 12 index 63f46a9..845b6d1 100644 13 --- a/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc 14 +++ b/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc 15 @@ -101,6 +101,14 @@ struct __eh_globals_init 16 17 ~__eh_globals_init() 18 { 19 + /* Work-around for an Android-specific bug, where this destructor 20 + * is called with a NULL object pointer. This is due to a bug in the 21 + * __cxa_finalize() implementation that was only fixed in 2.2. 22 + */ 23 +#ifdef __ANDROID__ 24 + if (this == NULL) 25 + return; 26 +#endif 27 if (_M_init) 28 __gthread_key_delete(_M_key); 29 _M_init = false; 30 -- 31 1.7.3.1 32 33