From 2a1c0cca80bb8a910c0026e0eab1f16c6e4c845b Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 20 Oct 2009 17:01:55 +0200 Subject: [PATCH] Handle failed connection to tracker daemon 0.7 series Also, consolidate string memory management, to be consistent and clear on a first sight. Related to changes in bug 596082. --- .../nautilus-search-engine-tracker.c | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libnautilus-private/nautilus-search-engine-tracker.c b/libnautilus-private/nautilus-search-engine-tracker.c index 3d2b465..eec8d74 100644 --- a/libnautilus-private/nautilus-search-engine-tracker.c +++ b/libnautilus-private/nautilus-search-engine-tracker.c @@ -97,7 +97,7 @@ search_callback (char **results, GError *error, gpointer user_data) char *uri; #ifdef HAVE_TRACKER_0_7 - uri = *results_p; + uri = g_strdup ((char *)*results_p); #else uri = g_filename_to_uri ((char *)*results_p, NULL, NULL); #endif @@ -109,12 +109,7 @@ search_callback (char **results, GError *error, gpointer user_data) nautilus_search_engine_hits_added (NAUTILUS_SEARCH_ENGINE (tracker), hit_uris); nautilus_search_engine_finished (NAUTILUS_SEARCH_ENGINE (tracker)); g_strfreev (results); -#ifdef HAVE_TRACKER_0_7 - g_list_free (hit_uris); -#else eel_g_list_free_deep (hit_uris); -#endif - } @@ -145,11 +140,11 @@ nautilus_search_engine_tracker_start (NautilusSearchEngine *engine) if (location_uri) { #ifdef HAVE_TRACKER_0_7 - location = location_uri; + location = g_strdup (location_uri); #else location = g_filename_from_uri (location_uri, NULL, NULL); - g_free (location_uri); #endif + g_free (location_uri); } else { location = NULL; } @@ -279,14 +274,16 @@ nautilus_search_engine_tracker_new (void) #ifdef HAVE_TRACKER_0_7 tracker_client = tracker_connect (FALSE, -1); #else - GError *err = NULL; - - tracker_client = tracker_connect (FALSE); + tracker_client = tracker_connect (FALSE); +#endif if (!tracker_client) { return NULL; } +#ifndef HAVE_TRACKER_0_7 + GError *err = NULL; + tracker_get_version (tracker_client, &err); if (err != NULL) { -- 1.6.5.rc2