Skip to content

call: Properly unwind when failure - #23

Merged
obiwac merged 1 commit into
mainfrom
bugfix/call-unwind
Jul 11, 2026
Merged

call: Properly unwind when failure#23
obiwac merged 1 commit into
mainfrom
bugfix/call-unwind

Conversation

@obiwac

@obiwac obiwac commented Jul 11, 2026

Copy link
Copy Markdown
Member

This would cause problems because we'd set flamingo->env to the function's env, but then return without ever setting it back. This meant that if we failed and destroyed the flamingo object:

  • First, all values are dereferenced and destroyed, which means the function's env would be destroyed.
  • Then, we'd try to destroy flamingo->env, which would fail because it is one of the function environments we've already freed.
  • The previous/inital flamingo->env would never be freed.

Unwind properly now and be a little less dense.

Still, Flamingo error handling needs some TLC.

This would cause problems because we'd set flamingo->env to the
function's env, but then return without ever setting it back. This meant
that if we failed and destroyed the flamingo object:

- First, all values are dereferenced and destroyed, which means the
  function's env would be destroyed.
- Then, we'd try to destroy flamingo->env, which would fail because it
  is one of the function environments we've already freed.
- The previous/inital flamingo->env would never be freed.

Unwind properly now and be a little less dense.

Still, Flamingo error handling needs some TLC.
@obiwac obiwac added the bug Something isn't working label Jul 11, 2026
@obiwac
obiwac merged commit 904e071 into main Jul 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant