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

AsComponent: Centralize GOnce guard to fix an assertion failure #385

Merged
merged 2 commits into from Mar 5, 2022

Commits on Feb 26, 2022

  1. trivial: Make as_component_create_token_cache static

    It's no longer called from outside AsComponent, so it doesn't need to be
    extern any more.
    
    Signed-off-by: Simon McVittie <smcv@debian.org>
    smcv committed Feb 26, 2022
  2. AsComponent: Centralize GOnce guard to fix an assertion failure

    The token cache only needs to be created once per AsComponent.
    Previously, each of the two callers of as_component_create_token_cache()
    guarded it with an atomic (GOnce) access to priv->token_cache_valid,
    but the implementation had a redundant non-atomic guard. This resulted
    in a GLib assertion failure on leaving the function, because the atomic
    boolean flag indicating whether initialization has completed is not
    meant to be set non-null until g_once_init_leave().
    
    In particular, this resolves test failures in Flatpak 1.13.x
    (which has been ported from libappstream-glib to libappstream) when it
    runs `flatpak search` from its test suite.
    
    Resolves: ximion#384
    Signed-off-by: Simon McVittie <smcv@debian.org>
    smcv committed Feb 26, 2022