• Milan Crha's avatar
    gnetworkmonitor: Fix use-after-free when using from another thread · ca0add4b
    Milan Crha authored
    When using g_network_monitor_get_default() from another thread, it’s
    possible for network-changed events to be processed after an instance of
    GNetworkMonitor has been disposed, causing use-after-free problems.
    Fix that by moving some of the initialisation into the GInitable.init()
    chain, rather than in a main context idle callback.
    This includes a unit test which probabilistically reproduces the bug
    (but can’t do so deterministically due to it being a race condition).
    Commit amended by Philip Withnall <withnall@endlessm.com> before
gwin32networkmonitor.c 9.97 KB