From 9490f8d7e435d60b76d5fca12ba6332a5f058fa5 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Thu, 8 Mar 2001 17:11:42 +0000 Subject: [PATCH] eek, fixed old hook detail storage code. Thu Mar 8 18:11:52 2001 Tim Janik * gsignal.c: eek, fixed old hook detail storage code. --- gobject/ChangeLog | 4 ++++ gobject/gsignal.c | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gobject/ChangeLog b/gobject/ChangeLog index ffe8c7605..78a96cd40 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,7 @@ +Thu Mar 8 18:11:52 2001 Tim Janik + + * gsignal.c: eek, fixed old hook detail storage code. + Thu Mar 8 16:35:48 2001 Tim Janik * gparamspecs.[hc]: s/g_param_spec_string_c/g_param_spec_stringc/. diff --git a/gobject/gsignal.c b/gobject/gsignal.c index aaeedb797..036ab4bd6 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -154,6 +154,13 @@ typedef struct GSignalAccumulator func; gpointer data; } SignalAccumulator; +typedef struct +{ + GHook hook; + GQuark detail; +} SignalHook; +#define SIGNAL_HOOK(hook) ((SignalHook*) (hook)) + struct _SignalNode { /* permanent portion */ @@ -755,6 +762,7 @@ g_signal_add_emission_hook (guint signal_id, static guint seq_hook_id = 1; SignalNode *node; GHook *hook; + SignalHook *signal_hook; g_return_val_if_fail (signal_id > 0, 0); g_return_val_if_fail (hook_func != NULL, 0); @@ -776,13 +784,15 @@ g_signal_add_emission_hook (guint signal_id, if (!node->emission_hooks) { node->emission_hooks = g_new (GHookList, 1); - g_hook_list_init (node->emission_hooks, sizeof (GHook)); + g_hook_list_init (node->emission_hooks, sizeof (SignalHook)); node->emission_hooks->finalize_hook = signal_finalize_hook; } hook = g_hook_alloc (node->emission_hooks); hook->data = hook_data; hook->func = hook_func; hook->destroy = data_destroy; + signal_hook = SIGNAL_HOOK (hook); + signal_hook->detail = detail; node->emission_hooks->seq_id = seq_hook_id; g_hook_append (node->emission_hooks, hook); seq_hook_id = node->emission_hooks->seq_id; @@ -1945,14 +1955,14 @@ signal_emit_R (SignalNode *node, { gboolean need_destroy, was_in_call, may_recurse = TRUE; GHook *hook; - + emission_state = EMISSION_HOOK; hook = g_hook_first_valid (node->emission_hooks, may_recurse); while (hook) { - GQuark hook_detail = GPOINTER_TO_UINT (hook->func); + SignalHook *signal_hook = SIGNAL_HOOK (hook); - if (!hook_detail || hook_detail == detail) + if (!signal_hook->detail || signal_hook->detail == detail) { GSignalEmissionHook hook_func = hook->func;