]> code.delx.au - pulseaudio/commitdiff
dbus-protocol, dbusiface-core: Take a reference when storing the core pointer.
authorTanu Kaskinen <tanuk@iki.fi>
Tue, 4 Aug 2009 14:55:10 +0000 (17:55 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Tue, 4 Aug 2009 14:55:10 +0000 (17:55 +0300)
src/modules/dbus/iface-core.c
src/pulsecore/protocol-dbus.c

index 695e4a3cfbae92ed0019b8a9323c1eb11a059479..ca9ba582e77d004537623e59ff7bb572cfce3db1 100644 (file)
@@ -1923,7 +1923,7 @@ pa_dbusiface_core *pa_dbusiface_core_new(pa_core *core) {
     pa_assert(core);
 
     c = pa_xnew(pa_dbusiface_core, 1);
-    c->core = core;
+    c->core = pa_core_ref(core);
     c->subscription = pa_subscription_new(core, PA_SUBSCRIPTION_MASK_ALL, subscription_cb, c);
     c->dbus_protocol = pa_dbus_protocol_get(core);
     c->cards = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
@@ -2044,6 +2044,7 @@ void pa_dbusiface_core_free(pa_dbusiface_core *c) {
     pa_hook_slot_free(c->extension_unregistered_slot);
 
     pa_dbus_protocol_unref(c->dbus_protocol);
+    pa_core_unref(c->core);
 
     pa_xfree(c);
 }
index 475b952fc15b1da8d56614506301aceddc550372..8fc080320a229976cfdaabe88691aedf513eb6e0 100644 (file)
@@ -117,7 +117,7 @@ static pa_dbus_protocol *dbus_protocol_new(pa_core *c) {
 
     p = pa_xnew(pa_dbus_protocol, 1);
     PA_REFCNT_INIT(p);
-    p->core = c;
+    p->core = pa_core_ref(c);
     p->objects = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     p->connections = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
     p->extensions = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
@@ -170,6 +170,8 @@ void pa_dbus_protocol_unref(pa_dbus_protocol *p) {
 
     pa_assert_se(pa_shared_remove(p->core, "dbus-protocol") >= 0);
 
+    pa_core_unref(p->core);
+
     pa_xfree(p);
 }