Skip to content

gi: Remove garbage collection checks before calling callbacks

Evan Welsh requested to merge ewlsh/remove-gc-checks into master

These checks were put in place to ensure we didn't cause crashes by accessing objects while they were tearing down. With incremental GC, though, these checks can be triggered by callbacks which declare local variables because SpiderMonkey will execute JavaScript code during "sweeping".

We already reset signal callbacks when an object is torn down and we check if a vfunc's GObject has an associated JSObject.

With the current state of our checks, to prevent segfaults from vfunc_destroy (and similar vfuncs) we just need a check which prevents calling callbacks when an instance wrapper does not exist for a given vfunc. If we don't check for the wrapper first, we end up running code which causes a segfault in SpiderMonkey's garbage collection due to invalid state.

Edited by Evan Welsh

Merge request reports