Skip to content

Fix memory leak in template signal handlers

James Westman requested to merge jwestman/gjs:fix-template-memory-leak into master

Fixes #576 (closed).

  • Added support for passing boxed closures to GI.
  • Added a new system function, associateClosure, which takes an object and a JavaScript function and returns a boxed closure that is bound to the object's lifetime using the existing ObjectInstance::associate_closure mechanism.
  • Similarly, added Object.connect_object which takes a function and an object, and binds the closure to the object's lifetime.
  • Changed the Gtk template override to associate signal handler closures to the lifetime of the current object, matching the behavior of templates in C.
  • Added a test to ensure the template is not leaked.

See the issue and the commit messages for more details.

Merge request reports