[libdmapsharing] Fix some bugs related to the recent DmapMdnsPublisher singleton change



commit 9673c3ab89cbf059ed22a99fe6893e3437f3c950
Author: W. Michael Petullo <mike flyn org>
Date:   Wed Sep 29 13:26:51 2010 -0500

    Fix some bugs related to the recent DmapMdnsPublisher singleton change
    
    There were some mistakes left over from the DmapMdnsPublisher singleton
    change that were identified while working on Rhythmbox. Rhythmbox woud
    crash when a user enabled, disabled and then enabled the DAAP plugin.
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dmap-mdns-avahi.c           |    5 ++++-
 libdmapsharing/dmap-mdns-publisher-avahi.c |   12 +++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/libdmapsharing/dmap-mdns-avahi.c b/libdmapsharing/dmap-mdns-avahi.c
index 8aa8f97..7a7f267 100644
--- a/libdmapsharing/dmap-mdns-avahi.c
+++ b/libdmapsharing/dmap-mdns-avahi.c
@@ -108,7 +108,10 @@ dmap_mdns_avahi_get_client (void)
 void
 dmap_mdns_avahi_set_entry_group (AvahiEntryGroup *eg)
 {
-	g_assert (eg == NULL || entry_group == NULL);
+	/* FIXME: No longer a valid assumption with new multiple-protocol
+	 * per process code. Refactor?
+	 * g_assert (eg == NULL || entry_group == NULL);
+	 */
 	g_assert (avahi_entry_group_get_client (eg) == client);
 	entry_group = eg;
 }
diff --git a/libdmapsharing/dmap-mdns-publisher-avahi.c b/libdmapsharing/dmap-mdns-publisher-avahi.c
index a7a3487..e092837 100644
--- a/libdmapsharing/dmap-mdns-publisher-avahi.c
+++ b/libdmapsharing/dmap-mdns-publisher-avahi.c
@@ -450,11 +450,21 @@ dmap_mdns_publisher_finalize (GObject *object)
 		publisher->priv->entry_group = NULL;
 	}
 
-	avahi_client_free (publisher->priv->client);
+	/* FIXME: dmap_mdns_avahi_get_client() ensures that a client is initialized only
+	 * once during the lifetime of a program. This needs to be changed so that the
+	 * following call works. Otherwise, an application like Rhythmbox will crash if 
+	 * a user deactivates and then activates the DAAP plugin. In this case,
+	 * publisher->priv->client will be free'd but will not be allocated in a
+	 * successive call to dmap_mdns_avahi_get_client().
+	 *
+	 * avahi_client_free (publisher->priv->client);
+	 */
 
 	g_slist_foreach (publisher->priv->service, (GFunc) free_service, NULL);
 	g_slist_free (publisher->priv->service);
 
+	publisher_object = NULL;
+
 	G_OBJECT_CLASS (dmap_mdns_publisher_parent_class)->finalize (object);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]