[gimp/soc-2011-gimpunitentry: 49/68] GimpUnitEntryTable: fix for bug in get_nth_entry()



commit 7fbfbfa4ba0224d14c3301a6521faedf6c3b5f00
Author: Enrico Schröder <enni schroeder gmail com>
Date:   Tue Jul 12 23:41:50 2011 +0200

    GimpUnitEntryTable: fix for bug in get_nth_entry()
    
    Reversed to standard order since GHashTable iterators apparently do work "FIFO"

 libgimpwidgets/gimpunitentrytable.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/libgimpwidgets/gimpunitentrytable.c b/libgimpwidgets/gimpunitentrytable.c
index ee7448d..28b17ce 100644
--- a/libgimpwidgets/gimpunitentrytable.c
+++ b/libgimpwidgets/gimpunitentrytable.c
@@ -287,8 +287,7 @@ gimp_unit_entry_table_get_nth_entry (GimpUnitEntryTable *table,
     return NULL;
   }
 
-  /* reverse order because first added element is last in g_hash_table */
-  i = g_hash_table_size (table->entries) - 1;
+  i = 0;
 
   g_hash_table_iter_init (&iter, table->entries);
 
@@ -296,7 +295,7 @@ gimp_unit_entry_table_get_nth_entry (GimpUnitEntryTable *table,
   {
     if (i == index)
       return GIMP_UNIT_ENTRY (value);
-    i--;
+    i++;
   }
 
   return NULL;


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