[gtk/wip/chergert/spellcheck] spellcheck: handle ownership transfer



commit 9bc959a46aa7e7903d76c7fd9cfb69c0761fac0b
Author: Christian Hergert <chergert redhat com>
Date:   Mon Mar 15 15:04:45 2021 -0700

    spellcheck: handle ownership transfer

 gtk/gtkspellcheck.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkspellcheck.c b/gtk/gtkspellcheck.c
index deb39d4fc6..4b72177c6d 100644
--- a/gtk/gtkspellcheck.c
+++ b/gtk/gtkspellcheck.c
@@ -340,14 +340,14 @@ gtk_spell_checker_list_corrections (GtkSpellChecker *self,
   if (self->languages->len == 0)
     return G_LIST_MODEL (gtk_string_list_new (NULL));
 
-  store = g_list_store_new (G_TYPE_LIST_MODEL);
-
   if (self->languages->len == 1)
     {
       GtkSpellLanguage *language = g_ptr_array_index (self->languages, 0);
       return language->provider->list_corrections (language, word, word_length);
     }
 
+  store = g_list_store_new (G_TYPE_LIST_MODEL);
+
   for (guint i = 0; i < self->languages->len; i++)
     {
       GtkSpellLanguage *language = g_ptr_array_index (self->languages, i);
@@ -362,8 +362,6 @@ gtk_spell_checker_list_corrections (GtkSpellChecker *self,
 
   ret = gtk_flatten_list_model_new (G_LIST_MODEL (store));
 
-  g_object_unref (store);
-
   return G_LIST_MODEL (ret);
 }
 


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