Marco Trevisan (Treviño) has proposed merging 
~3v1n0/ubuntu/+source/nautilus:ubuntu/master into 
~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/master.

Requested reviews:
  Ubuntu Desktop (ubuntu-desktop)

For more details, see:
https://code.launchpad.net/~3v1n0/ubuntu/+source/nautilus/+git/nautilus/+merge/356146
-- 
Your team Ubuntu Desktop is requested to review the proposed merge of 
~3v1n0/ubuntu/+source/nautilus:ubuntu/master into 
~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/master.
diff --git a/debian/changelog b/debian/changelog
index 10b8325..371cb1e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+nautilus (1:3.26.4-0ubuntu6) UNRELEASED; urgency=medium
+
+  * d/p/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch:
+    - Refreshed to add memory leak and potential crash fixes
+
+ -- Marco Trevisan (Treviño) <ma...@ubuntu.com>  Thu, 04 Oct 2018 18:41:10 +0200
+
 nautilus (1:3.26.4-0ubuntu5) cosmic; urgency=medium
 
   * d/p/search-engine-Query-file-system-to-determine-remoteness.patch:
diff --git a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
index 20e597c..d2c1db5 100644
--- a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
+++ b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
@@ -13,13 +13,14 @@ simple engine will be already fast enough, while running this engine could be
 just a waste.
 
 Origin: upstream
-Applied-Upstream: https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e6
+Applied-Upstream: 3.30.0, https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e6
+Forwarded: yes, https://gitlab.gnome.org/GNOME/nautilus/merge_requests/323
 ---
  src/meson.build                     |   2 +
- src/nautilus-search-engine-recent.c | 427 ++++++++++++++++++++++++++++++++++++
+ src/nautilus-search-engine-recent.c | 440 ++++++++++++++++++++++++++++++++++++
  src/nautilus-search-engine-recent.h |  36 +++
  src/nautilus-search-engine.c        |  11 +
- 4 files changed, 476 insertions(+)
+ 4 files changed, 489 insertions(+)
  create mode 100644 src/nautilus-search-engine-recent.c
  create mode 100644 src/nautilus-search-engine-recent.h
 
@@ -38,10 +39,10 @@ index 73aafe9..213b35f 100644
      'nautilus-search-hit.c',
 diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c
 new file mode 100644
-index 0000000..bbd0d82
+index 0000000..bdd130d
 --- /dev/null
 +++ b/src/nautilus-search-engine-recent.c
-@@ -0,0 +1,427 @@
+@@ -0,0 +1,440 @@
 +/*
 + * Copyright (C) 2018 Canonical Ltd
 + *
@@ -86,6 +87,7 @@ index 0000000..bbd0d82
 +    NautilusQuery *query;
 +    GCancellable *cancellable;
 +    GtkRecentManager *recent_manager;
++    guint add_hits_idle_id;
 +};
 +
 +static void nautilus_search_provider_init (NautilusSearchProviderInterface *iface);
@@ -115,11 +117,13 @@ index 0000000..bbd0d82
 +{
 +    NautilusSearchEngineRecent *self = NAUTILUS_SEARCH_ENGINE_RECENT (object);
 +
-+    if (self->cancellable)
++    if (self->add_hits_idle_id != 0)
 +    {
-+        g_cancellable_cancel (self->cancellable);
++        g_source_remove (self->add_hits_idle_id);
 +    }
 +
++    g_cancellable_cancel (self->cancellable);
++
 +    g_clear_object (&self->query);
 +    g_clear_object (&self->cancellable);
 +
@@ -140,6 +144,8 @@ index 0000000..bbd0d82
 +    NautilusSearchEngineRecent *self = search_hits->recent;
 +    NautilusSearchProvider *provider = NAUTILUS_SEARCH_PROVIDER (self);
 +
++    self->add_hits_idle_id = 0;
++
 +    if (!g_cancellable_is_cancelled (self->cancellable))
 +    {
 +        nautilus_search_provider_hits_added (provider, search_hits->hits);
@@ -147,18 +153,36 @@ index 0000000..bbd0d82
 +    }
 +
 +    g_list_free_full (search_hits->hits, g_object_unref);
-+    g_object_unref (self->query);
 +    g_clear_object (&self->cancellable);
-+    g_object_unref (self);
 +    g_free (search_hits);
 +
 +    nautilus_search_provider_finished (provider,
 +                                       NAUTILUS_SEARCH_PROVIDER_STATUS_NORMAL);
 +    g_object_notify (G_OBJECT (provider), "running");
 +
++    g_object_unref (self);
++
 +    return FALSE;
 +}
 +
++static void
++search_add_hits_idle (NautilusSearchEngineRecent *self,
++                      GList                      *hits)
++{
++    SearchHitsData *search_hits;
++
++    if (self->add_hits_idle_id != 0)
++    {
++        return;
++    }
++
++    search_hits = g_new0 (SearchHitsData, 1);
++    search_hits->recent = self;
++    search_hits->hits = hits;
++
++    self->add_hits_idle_id = g_idle_add (search_thread_add_hits_idle, search_hits);
++}
++
 +static gboolean
 +is_file_valid_recursive (NautilusSearchEngineRecent *self,
 +                         GFile                      *file,
@@ -272,8 +296,8 @@ index 0000000..bbd0d82
 +
 +        if (rank <= 0)
 +        {
-+            name = gtk_recent_info_get_short_name (info);
-+            rank = nautilus_query_matches_string (self->query, name);
++            g_autofree char *short_name = gtk_recent_info_get_short_name (info);
++            rank = nautilus_query_matches_string (self->query, short_name);
 +        }
 +
 +        if (rank > 0)
@@ -340,11 +364,7 @@ index 0000000..bbd0d82
 +        }
 +    }
 +
-+    search_hits = g_new0 (SearchHitsData, 1);
-+    search_hits->recent = self;
-+    search_hits->hits = hits;
-+
-+    g_idle_add (search_thread_add_hits_idle, search_hits);
++    search_add_hits_idle (self, hits);
 +
 +    g_list_free_full (recent_items, (GDestroyNotify) gtk_recent_info_unref);
 +    g_list_free_full (mime_types, g_free);
@@ -362,23 +382,17 @@ index 0000000..bbd0d82
 +    g_return_if_fail (self->query);
 +    g_return_if_fail (self->cancellable == NULL);
 +
-+    g_object_ref (self);
-+    g_object_ref (self->query);
-+
 +    location = nautilus_query_get_location (self->query);
 +
 +    if (!is_recursive_search (NAUTILUS_SEARCH_ENGINE_TYPE_INDEXED,
 +                              nautilus_query_get_recursive (self->query),
 +                              location))
 +    {
-+        SearchHitsData *search_hits;
-+        search_hits = g_new0 (SearchHitsData, 1);
-+        search_hits->recent = self;
-+
-+        g_idle_add (search_thread_add_hits_idle, search_hits);
++        search_add_hits_idle (self, NULL);
 +        return;
 +    }
 +
++    g_object_ref (self);
 +    self->cancellable = g_cancellable_new ();
 +
 +    thread = g_thread_new ("nautilus-search-recent", recent_thread_func, self);
-- 
ubuntu-desktop mailing list
ubuntu-desktop@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to