Skip to content

signalTracker: Improve testing, fix some edge cases and support SWAPPED and ONCE connection flags

After some discussion, this is meant to be one of the prerequisites of !2330, as we can now implement the Promises for signal connections taking advantage of the signalTracker auto-cleanup.

However, while doing this I've noticed some areas we could improve to make that happen reducing the special code involved there.

In particular, with this branch signal handlers that are connected with no flags or GObject.ConnectFlags.DEFAULT will be called multiple times, while using the new GObject.ConnectFlags.SHELL_ONCE (naming can be discussed, while I'm planning to add GObject.ConnectFlags.ONCE to upstream GLib) the signal will be auto-disconnected on first callback invocation.
This will be relevant for the promises too, because we can avoid doing some cleanup at promises resolving/rejecting level, while objects could create a signal-connection promise with a GObject.ConnectFlags.DEFAULT flag (instead of the default GObject.ConnectFlags.SHELL_ONCE) to create a promise that can be manually be resolved (see !1628 (comment 1039924))

Edited by Marco Trevisan

Merge request reports