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