Fix a bug in ObjC++ EH.

Throwing an Objective-C exception through a C++ catch block was broken.
This was because the C++ code inserts a cleanup handler to make sure
that it invokes `__cxa_end_catch`.  Unwinding through this catchup
transformed the Objective-C exception into a C++ one.  This case should
have been handled, except for two bugs:

1. A typo (`#ifdef` instead of `#ifndef`) meant that we were not
   extracting the Objective-C exception from the C++ object.
2. We were skipping everything except catchalls after the search phase,
   because we lose some information in the transformation.

Fixes #49
main
David Chisnall 8 years ago
parent f6709519fa
commit 7bd78e5b46

@ -330,7 +330,7 @@ static inline _Unwind_Reason_Code internal_objc_personality(int version,
// The object to return
void *object = NULL;
#ifdef NO_OBJCXX
#ifndef NO_OBJCXX
if (exceptionClass == cxx_exception_class)
{
int objcxx;
@ -421,7 +421,7 @@ static inline _Unwind_Reason_Code internal_objc_personality(int version,
// If this is not a cleanup, ignore it and keep unwinding.
//if (check_action_record(context, foreignException, &lsda,
//action.action_record, thrown_class, &selector) != handler_cleanup)
if (handler != handler_cleanup)
if ((handler != handler_cleanup) && !objcxxException)
{
DEBUG_LOG("Ignoring handler! %d\n",handler);
return continueUnwinding(exceptionObject, context);

Loading…
Cancel
Save