Skip to content

Commit

Permalink
Fixed subtle bug in try_handle_some when exceptions are thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Dec 17, 2023
1 parent 9968dd0 commit 98e9926
Show file tree
Hide file tree
Showing 2 changed files with 183 additions and 48 deletions.
9 changes: 6 additions & 3 deletions include/boost/leaf/handle_errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,7 @@ try_handle_some( TryBlock && try_block, H && ... h )
auto active_context = activate_context(ctx);
if( auto r = leaf_detail::try_catch_(ctx, std::forward<TryBlock>(try_block), std::forward<H>(h)...) )
return r;
else if( !ctx.is_active() )
return r;
else
else if( ctx.is_active() )
{
leaf_detail::unload_result(&r);
error_id id = r.error();
Expand All @@ -949,6 +947,11 @@ try_handle_some( TryBlock && try_block, H && ... h )
ctx.unload(rr.error());
return rr;
}
else
{
ctx.unload(r.error());
return r;
}
}

template <class TryBlock, class... H>
Expand Down
Loading

0 comments on commit 98e9926

Please sign in to comment.