Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type of signal IDs, make disconnection more obviously correct #184

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

smcv
Copy link
Contributor

@smcv smcv commented Feb 10, 2025

  • Fix type used for signal IDs

    While trying to investigate intermittent segfault during automated tests #169 I noticed that inputcapture was using
    guint instead of the correct gulong for GObject signal IDs, which could
    conceivably result in a signal ID being truncated and the wrong signal
    being disconnected (although in practice signal IDs are allocated
    starting from 0, so this is unlikely). The same pattern is seen in all
    of the other portals.

    Using the correct type also allows g_clear_signal_handler() to be used,
    for idempotent signal disconnections.

  • Consistently use g_clear_signal_handler to disconnect GObject signals

    This is more concise than writing out equivalent code every time,
    and ensures that signal disconnection is idempotent and that the correct
    type (gulong) is always used for the signal ID.

smcv added 2 commits February 9, 2025 23:42
While trying to investigate flatpak#169 I noticed that inputcapture was using
guint instead of the correct gulong for GObject signal IDs, which could
conceivably result in a signal ID being truncated and the wrong signal
being disconnected (although in practice signal IDs are allocated
starting from 0, so this is unlikely). The same pattern is seen in all
of the other portals.

Using the correct type also allows g_clear_signal_handler() to be used,
for idempotent signal disconnections.

Signed-off-by: Simon McVittie <[email protected]>
This is more concise than writing out equivalent code every time,
and ensures that signal disconnection is idempotent and that the correct
type (gulong) is always used for the signal ID.

Signed-off-by: Simon McVittie <[email protected]>
@smcv smcv merged commit 7b6d345 into flatpak:main Feb 10, 2025
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants