[gcr/wip/dueno/ghash: 2/2] system-prompter: Fix use of g_hash_table_lookup_extended



commit 038962d643361f44ddb58ae9611a9386b291e7f1
Author: Daiki Ueno <dueno src gnome org>
Date:   Sat Sep 29 09:40:14 2018 +0200

    system-prompter: Fix use of g_hash_table_lookup_extended
    
    Since the glib commit 8dc8b33d, g_hash_table_lookup_extended() started
    to clear the argument to NULL, even if the lookup failed.  Do not
    expect the original key is preserved in that case.
    
    Fixes #9.

 gcr/gcr-system-prompter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gcr/gcr-system-prompter.c b/gcr/gcr-system-prompter.c
index 975abe4..39250e7 100644
--- a/gcr/gcr-system-prompter.c
+++ b/gcr/gcr-system-prompter.c
@@ -491,17 +491,19 @@ prompt_stop_prompting (GcrSystemPrompter *self,
        ActivePrompt *active;
        GVariant *retval;
        gpointer watch;
+       Callback *orig_callback;
 
        g_debug ("stopping prompting for operation %s@%s",
                 callback->path, callback->name);
 
        /* Get a pointer to our actual callback */
        if (!g_hash_table_lookup_extended (self->pv->callbacks, callback,
-                                          (gpointer *)&callback, &watch)) {
+                                          (gpointer *)&orig_callback, &watch)) {
                g_debug ("couldn't find the callback for prompting operation %s@%s",
                         callback->path, callback->name);
                return;
        }
+       callback = orig_callback;
 
        /*
         * We remove these from the callbacks hash table so that we don't


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