diff options
| author | Michael Biebl <biebl@debian.org> | 2012-06-29 20:12:59 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2012-06-29 20:12:59 +0200 |
| commit | ec7b2a4d322996da1e4b221f2f713652bf868d3b (patch) | |
| tree | 88cd588a74c0de932f7cac871273b08b86fd759c /libnm-glib/nm-object-cache.c | |
| parent | 1376a21247cfd9d8bb1d4da7195112d03ff6e870 (diff) | |
| parent | 867254ea7c2b193fecf8cd36cc6e5dc53c290d92 (diff) | |
Merge tag 'upstream/0.9.5.95' into experimental
Upstream version 0.9.5.95
Diffstat (limited to 'libnm-glib/nm-object-cache.c')
| -rw-r--r-- | libnm-glib/nm-object-cache.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libnm-glib/nm-object-cache.c b/libnm-glib/nm-object-cache.c index 741f1291..2748b1df 100644 --- a/libnm-glib/nm-object-cache.c +++ b/libnm-glib/nm-object-cache.c @@ -64,3 +64,28 @@ _nm_object_cache_get (const char *path) return object ? g_object_ref (object) : NULL; } +void +_nm_object_cache_clear (NMObject *except) +{ + GHashTableIter iter; + NMObject *obj; + const char *path; + char *foo; + + _init_cache (); + g_hash_table_iter_init (&iter, cache); + while (g_hash_table_iter_next (&iter, (gpointer) &path, (gpointer) &obj)) { + if (obj != except) { + /* Remove the callback so that if the object isn't yet released + * by a client, when it does finally get unrefed, it won't trigger + * the cache removal for a new object with the same path as the + * one being released. + */ + foo = g_object_steal_data (G_OBJECT (obj), "nm-object-cache-tag"); + g_free (foo); + + g_hash_table_iter_remove (&iter); + } + } +} + |