summaryrefslogtreecommitdiffstats
path: root/src/pulse/context.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-08 20:06:21 +0100
committerColin Guthrie <cguthrie@mandriva.org>2010-02-09 22:28:17 +0000
commit66dbca1e06af0607a2d0fc6b8d14ef1ebb034f0a (patch)
treea15713062e04f6c9dc50a2139e2192a9c3c89c3e /src/pulse/context.c
parent5e2a80c7e33a9f32058d53c33519197567a9887a (diff)
dbus: remove filter functions only if they were actually set before
This fixes an assert when destructing modules that have not been fully initialized. https://bugzilla.redhat.com/show_bug.cgi?id=548525
Diffstat (limited to 'src/pulse/context.c')
-rw-r--r--src/pulse/context.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 83e0dbb5..8875bfd8 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -145,7 +145,7 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
pa_init_i18n();
- c = pa_xnew(pa_context, 1);
+ c = pa_xnew0(pa_context, 1);
PA_REFCNT_INIT(c);
c->proplist = p ? pa_proplist_copy(p) : pa_proplist_new();
@@ -157,9 +157,6 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
c->system_bus = c->session_bus = NULL;
#endif
c->mainloop = mainloop;
- c->client = NULL;
- c->pstream = NULL;
- c->pdispatch = NULL;
c->playback_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
c->record_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
c->client_index = PA_INVALID_INDEX;
@@ -170,22 +167,9 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
c->error = PA_OK;
c->state = PA_CONTEXT_UNCONNECTED;
- c->ctag = 0;
- c->csyncid = 0;
reset_callbacks(c);
- c->is_local = FALSE;
- c->server_list = NULL;
- c->server = NULL;
-
- c->do_shm = FALSE;
-
- c->server_specified = FALSE;
- c->no_fail = FALSE;
- c->do_autospawn = FALSE;
- memset(&c->spawn_api, 0, sizeof(c->spawn_api));
-
#ifndef MSG_NOSIGNAL
#ifdef SIGPIPE
pa_check_signal_is_blocked(SIGPIPE);
@@ -255,12 +239,14 @@ static void context_free(pa_context *c) {
#ifdef HAVE_DBUS
if (c->system_bus) {
- dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->system_bus), filter_cb, c);
+ if (c->filter_added)
+ dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->system_bus), filter_cb, c);
pa_dbus_wrap_connection_free(c->system_bus);
}
if (c->session_bus) {
- dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->session_bus), filter_cb, c);
+ if (c->filter_added)
+ dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->session_bus), filter_cb, c);
pa_dbus_wrap_connection_free(c->session_bus);
}
#endif
@@ -794,6 +780,7 @@ static void track_pulseaudio_on_dbus(pa_context *c, DBusBusType type, pa_dbus_wr
pa_log_warn("Failed to add filter function");
goto fail;
}
+ c->filter_added = TRUE;
if (pa_dbus_add_matches(
pa_dbus_wrap_connection_get(*conn), &error,