diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2020-03-16 22:06:04 -0700 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2020-04-19 10:51:26 -0700 |
commit | a147866bca54e8b752142c9c8bd66bcf46fe2688 (patch) | |
tree | fefcb53ae3523504f10d602786cdacfe985f2c9b /examples | |
parent | 8ad2276111b9b031ad0b7d3ecc64864024c7fc5c (diff) | |
download | gjs-a147866bca54e8b752142c9c8bd66bcf46fe2688.tar.gz |
object: Fix signal match mechanism
The previous mechanism, of stuffing the JSFunction pointer into the
closure data and matching it with G_SIGNAL_MATCH_DATA, did not work in
some cases. Apparently the garbage collector can move functions around
even outside of us getting a notification in the trace handler. This
caused occasional test failures where the wrong number of signals would
get disconnected or blocked.
Instead, match with G_SIGNAL_MATCH_CLOSURE. But since signal connections
to the same JS function still have different GClosure structs, we need
to search the object's connected signals and match any of them that have
the JS function as their callable object.
In the case of disconnect, we need to store all the candidate GClosures
in a separate vector and then potentially disconnect them, since
otherwise they might get removed from the m_closures list while it is
being iterated.
Keep the old way, with just one call to the GObject API, as fallback in
case the API user is not matching by function.
Diffstat (limited to 'examples')
0 files changed, 0 insertions, 0 deletions