banshee r4975 - in trunk/banshee: . src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper



Author: gburt
Date: Mon Jan 26 22:30:11 2009
New Revision: 4975
URL: http://svn.gnome.org/viewvc/banshee?rev=4975&view=rev

Log:
2009-01-26  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs:
	Fix bug with getting into a loop, constantly trying to reconnect to an
	indexer while in the middle of connecting to it.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs

Modified: trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs	Mon Jan 26 22:30:11 2009
@@ -54,6 +54,7 @@
         
         public void Start ()
         {
+            ShowDebugMessages = true;
             Debug ("Acquiring org.freedesktop.DBus session instance");
             session_bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));
             session_bus.NameOwnerChanged += OnBusNameOwnerChanged;
@@ -71,10 +72,7 @@
         {
             if (name == indexer_bus_name) {
                 Debug ("NameOwnerChanged: {0}, '{1}' => '{2}'", name, oldOwner, newOwner);
-                if (String.IsNullOrEmpty (newOwner)) {
-                    // Do not disconnect since we're already disconnected
-                    ResetInternalState ();
-                } else {
+                if (service == null && !String.IsNullOrEmpty (newOwner)) {
                     ConnectToIndexerService ();
                 }
             }
@@ -147,6 +145,11 @@
             
             try {
                 service.CleanupAndShutdown -= OnCleanupAndShutdown;
+            } catch (Exception e) {
+                Debug (e.ToString ());
+            }
+
+            try {
                 service.Shutdown ();
             } catch (Exception e) {
                 Debug (e.ToString ());
@@ -157,6 +160,10 @@
         
         private void ResetInternalState ()
         {
+            if (service == null) {
+                return;
+            }
+
             Debug ("Resetting internal state - service is no longer available or not needed");
             service = null;
             listening = false;



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