[java-atk-wrapper: 1/2] Fix iterating hash table in jaw_impl_finalize



commit a41a4cafced4b4da39fd32a3bbdb7190b65ace9c
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Mon Apr 1 23:44:37 2019 +0200

    Fix iterating hash table in jaw_impl_finalize
    
    236b9dda9b44 ('JNI: fix crash on java applications') turned
    jaw_impl_finalize's iter into a pointer, passed as such to
    g_hash_table_iter_init. But that is not how that API works, the original
    code was correct. This restores the original correct behavoir,
    avoiding warnings on jaw_obj finalizations.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=793620

 jni/src/jawimpl.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index d63e689..9a35afd 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -516,19 +516,18 @@ jaw_impl_finalize(GObject *gobject)
   jaw_obj->acc_context = NULL;
 
   /* Interface finalize */
-  GHashTableIter *iter = NULL;
-  gpointer *key = NULL;
-  gpointer *value = NULL;
+  GHashTableIter iter;
+  gpointer value;
 
-  g_hash_table_iter_init(iter, jaw_impl->ifaceTable);
-  while (g_hash_table_iter_next(iter, key, value))
+  g_hash_table_iter_init(&iter, jaw_impl->ifaceTable);
+  while (g_hash_table_iter_next(&iter, NULL, &value))
   {
     JawInterfaceInfo *info = (JawInterfaceInfo*)value;
     info->finalize(info->data);
 
     g_free(info);
 
-    g_hash_table_iter_remove(iter);
+    g_hash_table_iter_remove(&iter);
   }
   if (jaw_impl->ifaceTable != NULL)
   {


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