• Dan Winship's avatar
    libnm-glib: fix a crash when using multiple NMClients · fe264a2d
    Dan Winship authored
    NMObjectCache was assuming there would never be more than one object
    with the same path, but since NMClient is an NMObject, it was getting
    cached too, so if you created two clients and then unreffed one of
    them, it's possible the wrong one could get left in the cache, causing
    a crash the next time the other one called nm_object_cache_clear().
    Fix this by only adding NMObjects to the cache in the codepaths where
    we also check to see if the object was already in the cache.
    (This also means we can remove the "except" argument to
    nm_object_cache_clear(), since the NMClient won't be cached any more.)
nm-object-cache.h 1.19 KB