[rhythmbox] daap: be careful when enabling/disabling dacp
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] daap: be careful when enabling/disabling dacp
- Date: Sat, 18 Jun 2022 12:40:16 +0000 (UTC)
commit 578a4c74484bd7b7c8cc5897d7932ac98549a683
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Jun 18 22:36:08 2022 +1000
daap: be careful when enabling/disabling dacp
libdmapsharing4 uses assertions to make sure you're not stopping dacp
when it hasn't been started, so we have to check that the enable-remote
setting has actually changed before applying it.
Fixes: #1974
plugins/daap/rb-daap-plugin.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index a6284db51..578bd9375 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -95,6 +95,7 @@ struct _RBDaapPlugin
DmapMdnsBrowser *mdns_browser;
DmapControlShare *dacp_share;
+ gboolean dacp_share_started;
GHashTable *source_lookup;
@@ -203,9 +204,11 @@ impl_activate (PeasActivatable *bplugin)
rb_daap_sharing_init (shell);
plugin->dacp_share = rb_daap_create_dacp_share (G_OBJECT (plugin));
+ plugin->dacp_share_started = FALSE;
if (g_settings_get_boolean (plugin->dacp_settings, "enable-remote")) {
GError *error = NULL;
dmap_control_share_start_lookup_compat (plugin->dacp_share, &error);
+ plugin->dacp_share_started = TRUE;
}
register_daap_dbus_iface (plugin);
@@ -423,10 +426,14 @@ dacp_settings_changed_cb (GSettings *settings, const char *key, RBDaapPlugin *pl
{
if (g_strcmp0 (key, "enable-remote") == 0) {
GError *error = NULL;
- if (g_settings_get_boolean (settings, key)) {
- dmap_control_share_start_lookup_compat (plugin->dacp_share, &error);
- } else {
- dmap_control_share_stop_lookup_compat (plugin->dacp_share, &error);
+ if (g_settings_get_boolean (settings, key) != plugin->dacp_share_started) {
+ if (plugin->dacp_share_started) {
+ dmap_control_share_stop_lookup_compat (plugin->dacp_share, &error);
+ plugin->dacp_share_started = FALSE;
+ } else {
+ dmap_control_share_start_lookup_compat (plugin->dacp_share, &error);
+ plugin->dacp_share_started = TRUE;
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]