You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native cleanup callbacks erase outer frames from a propagating exception stack #229
A Haxe callback invoked by native RAII cleanup during exception unwinding can clear the runtime's unwinding state. Outer Haxe frames then disappear from CallStack.exceptionStack even though the exception continues through them.
Regression coverage first: test/regression/NativeCleanupExceptionStack, using the existing Main.hx/build.hxml/stdout.txt layout with HXCPP_STACK_TRACE and HXCPP_STACK_LINE. A Haxe wrapper passes a throwing action and an optional nonthrowing cleanup callback to a native helper. Its local C++ guard invokes the cleanup in its destructor. Catch the original exception outside the wrapper and check whether its exception stack includes the wrapper. Run once without cleanup as a control.
The cleanup callback returns normally. The original exception still reaches its catch; the defect is loss of stack information, not a reproduced crash or swallowed exception.
In include/hx/StackContext.h, pushFrame unconditionally sets mIsUnwindingException=false when a new Haxe function is entered. A cleanup callback can run while native exception unwinding is still active. Returning from that callback does not restore the outer unwinding state. Subsequent popFrame calls therefore stop recording the original exception's outer frames.
Track the state of the active exception unwind across nested calls, or otherwise restore it when a callback entered during cleanup returns. Preserve the separate behavior for a real catch, a new throw and a rethrow. Cover multiple native cleanup callbacks and a callback that catches its own local exception before returning.
This is separate from #63, which covers cppia catch handling. The reproduction uses compiled Haxe and a native C++ scope guard, with no cppia involved. No runtime implementation changes are included.
Activity
Keep recording an exception's stack after a cleanup callback