Skip to content

object: Fix GjsCallBackTrampoline's leaks

Marco Trevisan requested to merge 3v1n0/gjs:fix-trampoline-leaks into master

Each time we initialize a trampoline for vfunc implementation we never unref the memory it allocates, this was not noticed so far as GSlice seems to have confused the sanitizer.

To avoid this, let's add a further invalidation notifier where we unref the trampoline once the closure has been invalidated.

As per this, when manually invalidating the closure, let's add a temporary reference so that we can safely unref it again in the invalidation notify function without risks of acting on the last reference of the closure itself.

Each time we initialize a trampoline for vfunc implementation we never unref the memory it allocates, this was not noticed so far as GSlice seems to have confused the sanitizer.

To avoid this, let's add a further invalidation notifier where we unref the trampoline once the closure has been invalidated.

As per this, when manually invalidating the closure, let's add a temporary reference so that we can safely unref it again in the invalidation notify function without risks of acting on the last reference of the closure itself.

Merge request reports