Skip to content
This repository was archived by the owner on Oct 30, 2026. It is now read-only.

Sync bindings d0f6f4f: callback trampolines hold their callback and release their arguments - #36

Merged
bdbarnett merged 1 commit into
mainfrom
ostinato/sync-trampolines
Oct 15, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
ostinato/sync-trampolines

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

Syncs generated/lvgl_python.c from PyDevices/lvgl-bindings#35 (d0f6f4f). Two fixes for every LVGL callback that calls into Python:

  • A callback that replaces its own registration stays alive until it returns. timer.set_cb(other) from inside the timer callback used to drop the only reference to the running callback.
  • Callback arguments are released after the call. Every call leaked one reference to each argument, so a widget passed to a tree_walk callback was never freed.

tests/test_callback_references.py checks both in a subprocess under MALLOC_PERTURB_. Against the bindings before this sync it fails both ways: the callback is dead after replacing itself, and a widget's reference count is up by 10 after 10 tree walks. With this sync it passes, as do the full suite (30 tests) and lvgl-bindings' tools/test_lvgl_smoke.py.

This relies on #35: mp_lv_funcptr now returns a new reference, like every other converter the trampolines release.

…elease their arguments

A callback that replaced its own registration while it ran was freed
mid-call, and every callback call leaked a reference to each argument.
tests/test_callback_references.py covers both.
@bdbarnett
bdbarnett merged commit 2ff7e8e into main Oct 15, 2026
1 check passed
@bdbarnett
bdbarnett deleted the ostinato/sync-trampolines branch October 15, 2026 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant