[libpeas] Fix PeasEngine:loaded-plugins to return a proper array of strings



commit 05a55764513f59c381a012ac71a7e134bdd02b7f
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Feb 6 12:01:05 2011 -0800

    Fix PeasEngine:loaded-plugins to return a proper array of strings
    
    This also fixes applications using GSettings to bind a setting
    to PeasEngine:loaded-plugins.

 libpeas/peas-engine.c  |   13 ++-----------
 tests/libpeas/engine.c |    4 +++-
 2 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 2258563..f0bf234 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -1074,7 +1074,7 @@ peas_engine_create_extension (PeasEngine     *engine,
  * to free it using g_strfreev().
  *
  * Returns: (transfer full): A newly-allocated %NULL-terminated
- * array of strings, or %NULL.
+ * array of strings.
  */
 gchar **
 peas_engine_get_loaded_plugins (PeasEngine *engine)
@@ -1094,16 +1094,7 @@ peas_engine_get_loaded_plugins (PeasEngine *engine)
         }
     }
 
-  /* Bug in GArray? */
-  if (array->len == 0)
-    {
-      g_array_free (array, TRUE);
-      return NULL;
-    }
-  else
-    {
-      return (gchar **) g_array_free (array, FALSE);
-    }
+  return (gchar **) g_array_free (array, FALSE);
 }
 
 static gboolean
diff --git a/tests/libpeas/engine.c b/tests/libpeas/engine.c
index e60dfb1..ccc8217 100644
--- a/tests/libpeas/engine.c
+++ b/tests/libpeas/engine.c
@@ -240,7 +240,9 @@ test_engine_loaded_plugins (PeasEngine *engine)
   g_assert (loaded_plugins[1] == NULL);
 
   g_assert (peas_engine_unload_plugin (engine, info));
-  g_assert (loaded_plugins == NULL);
+
+  g_assert (loaded_plugins != NULL);
+  g_assert (loaded_plugins[0] == NULL);
   g_assert_cmpint (loaded, ==, 0);
 
   g_assert (peas_engine_load_plugin (engine, info));



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