[gabi++] Fix bug: Use un-exsited object in uncaught_exception.
We may call std::uncaught_exception before pthread_setspecific,
that means we should not use __cxa_get_globals_fast, since it won't get
the correct __cxa_eh_globals object. This will cause segmentation
fault at the following usage on the object.
Also, we can eliminate the redundant null pointer check since function
__cxa_get_globals will guarantee the returned value must not be NULL.
Change-Id: Ibcc177ab6da95331e212eee022f79c440cbcf821
Signed-off-by: WenHan Gu <Wenhan.gu@mediatek.com>
diff --git a/sources/cxx-stl/gabi++/src/terminate.cc b/sources/cxx-stl/gabi++/src/terminate.cc
index 576b18a..17435f9 100644
--- a/sources/cxx-stl/gabi++/src/terminate.cc
+++ b/sources/cxx-stl/gabi++/src/terminate.cc
@@ -157,11 +157,7 @@
bool uncaught_exception() throw() {
using namespace __cxxabiv1;
- __cxa_eh_globals* globals = __cxa_get_globals_fast();
- if (!globals) {
- return false;
- }
-
+ __cxa_eh_globals* globals = __cxa_get_globals();
return globals->uncaughtExceptions != 0;
}