[glib] Add NULL to end of g_filename_complete_get_completions() return value



commit e7a258692c7ae3d9075d9ae1926c08c7ec771f04
Author: Tom Parker <palfrey tevp net>
Date:   Fri Jun 26 22:43:31 2009 -0400

    Add NULL to end of g_filename_complete_get_completions() return value
    
    g_filename_complete_get_completions() return value is meant to be a
    g_strfreev-compatible array i.e. NULL-terminated. However, pointer arrays
    aren't automagically NULL-terminated. This fixes bug 586868

 gio/gfilenamecompleter.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gio/gfilenamecompleter.c b/gio/gfilenamecompleter.c
index 459e302..5247677 100644
--- a/gio/gfilenamecompleter.c
+++ b/gio/gfilenamecompleter.c
@@ -470,7 +470,7 @@ g_filename_completer_get_completion_suffix (GFilenameCompleter *completer,
  **/
 char **
 g_filename_completer_get_completions (GFilenameCompleter *completer,
-				      const char *initial_text)
+				      const char         *initial_text)
 {
   GList *possible_matches, *l;
   char *prefix;
@@ -486,14 +486,16 @@ g_filename_completer_get_completions (GFilenameCompleter *completer,
   for (l = possible_matches; l != NULL; l = l->next)
     {
       possible_match = l->data;
-      
+
       if (g_str_has_prefix (possible_match, prefix))
 	g_ptr_array_add (res,
 			 g_strconcat (initial_text, possible_match + strlen (prefix), NULL));
     }
 
   g_free (prefix);
-  
+
+  g_ptr_array_add (res, NULL);
+
   return (char**)g_ptr_array_free (res, FALSE);
 }
 



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