[pulseaudio-commits] 2 commits - src/modules
Arun Raghavan
arun at kemper.freedesktop.org
Sun May 29 05:18:19 UTC 2016
src/modules/dbus/iface-core.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
New commits:
commit f58e8c405c573a5a68be410d1add6dd1abeef9d6
Author: Arun Raghavan <arun at arunraghavan.net>
Date: Sun May 29 10:34:36 2016 +0530
dbus: Deal with double-counting module-dbus-protocol
We ended up dealing with it once in module init, and once more in the
new module callback. Avoiding it in the second case by name seems to be
the cleanest solution (else, we need to store the module index somewhere
in pa_dbusiface_core, which seems about as bad).
Signed-off-by: Arun Raghavan <arun at arunraghavan.net>
diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c
index 3d2c8ee..508913d 100644
--- a/src/modules/dbus/iface-core.c
+++ b/src/modules/dbus/iface-core.c
@@ -1588,6 +1588,14 @@ static pa_hook_result_t module_new_cb(void *hook_data, void *call_data, void *sl
pa_assert(c);
pa_assert(module);
+ if (pa_streq(module->name, "module-dbus-protocol")) {
+ /* module-dbus-protocol can only be loaded once, and will be accounted
+ * for while iterating core->modules in pa_dbusiface_core_new(). As it
+ * happens, we will also see it here when the hook is called after the
+ * module is initialised, so we ignore it. */
+ return PA_HOOK_OK;
+ }
+
module_iface = pa_dbusiface_module_new(module);
pa_assert_se(pa_hashmap_put(c->modules, PA_UINT32_TO_PTR(module->index), module_iface) >= 0);
commit 9c7e4b8eb9139ba494c5e3877a7f585f0eec9c62
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Sat May 28 18:54:04 2016 +0300
dbus: fix crash on LoadModule()
Commit ae415b07a07c9fe70714d01c91980edb25d966de ("dbus: Use hooks for
module new and removed events") changed the new module monitoring from
the asynchronous subscription system. Previously handle_load_module()
created the new pa_dbusiface_module object before we got
a notification of the loading of the module, but now we get the
notification already within the pa_module_load() call. That resulted
in a crash, because the module_new_cb() created the
pa_dbusiface_module object before pa_module_load() returned, and then
handle_load_module() would create another pa_dbusiface_module object
for the same module.
This patch removes the pa_dbusiface_module_new() call from
handle_load_module(). module_new_cb() is now responsible for all
pa_dbusiface_module object creations, except the ones that are created
during the initialization of module-dbus-protocol.
Signed-off-by: Arun Raghavan <arun at arunraghavan.net>
diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c
index 88e9030..3d2c8ee 100644
--- a/src/modules/dbus/iface-core.c
+++ b/src/modules/dbus/iface-core.c
@@ -1511,9 +1511,8 @@ static void handle_load_module(DBusConnection *conn, DBusMessage *msg, void *use
goto finish;
}
- dbus_module = pa_dbusiface_module_new(module);
- pa_hashmap_put(c->modules, PA_UINT32_TO_PTR(module->index), dbus_module);
-
+ /* This is created during module loading in module_new_cb() */
+ dbus_module = pa_hashmap_get(c->modules, PA_UINT32_TO_PTR(module->index));
object_path = pa_dbusiface_module_get_path(dbus_module);
pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_OBJECT_PATH, &object_path);
@@ -1589,20 +1588,18 @@ static pa_hook_result_t module_new_cb(void *hook_data, void *call_data, void *sl
pa_assert(c);
pa_assert(module);
- if (!(module_iface = pa_hashmap_get(c->modules, PA_UINT32_TO_PTR(module->index)))) {
- module_iface = pa_dbusiface_module_new(module);
- pa_assert_se(pa_hashmap_put(c->modules, PA_UINT32_TO_PTR(module->index), module_iface) >= 0);
+ module_iface = pa_dbusiface_module_new(module);
+ pa_assert_se(pa_hashmap_put(c->modules, PA_UINT32_TO_PTR(module->index), module_iface) >= 0);
- object_path = pa_dbusiface_module_get_path(module_iface);
+ object_path = pa_dbusiface_module_get_path(module_iface);
- pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_MODULE].name)));
- pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_MODULE].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
- dbus_message_unref(signal_msg);
- }
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
return PA_HOOK_OK;
}
More information about the pulseaudio-commits
mailing list