mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
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
This commit is contained in:
parent
5e2a80c7e3
commit
66dbca1e06
7 changed files with 34 additions and 34 deletions
|
|
@ -67,6 +67,7 @@ struct userdata {
|
|||
pa_core *core;
|
||||
pa_dbus_connection *connection;
|
||||
pa_hashmap *sessions;
|
||||
pa_bool_t filter_added;
|
||||
};
|
||||
|
||||
static void add_session(struct userdata *u, const char *id) {
|
||||
|
|
@ -300,7 +301,7 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
m->userdata = u = pa_xnew(struct userdata, 1);
|
||||
m->userdata = u = pa_xnew0(struct userdata, 1);
|
||||
u->core = m->core;
|
||||
u->module = m;
|
||||
u->connection = connection;
|
||||
|
|
@ -311,6 +312,8 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
u->filter_added = TRUE;
|
||||
|
||||
if (pa_dbus_add_matches(
|
||||
pa_dbus_connection_get(connection), &error,
|
||||
"type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionAdded'",
|
||||
|
|
@ -359,7 +362,9 @@ void pa__done(pa_module *m) {
|
|||
"type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionAdded'",
|
||||
"type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionRemoved'", NULL);
|
||||
|
||||
dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u);
|
||||
if (u->filter_added)
|
||||
dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u);
|
||||
|
||||
pa_dbus_connection_unref(u->connection);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue