simple-event-hook: do not pass the dispatcher as argument to the closure
This commit is contained in:

committed by
Julian Bouzas

parent
4c7cb5145d
commit
f91ff40a2d
@@ -428,7 +428,7 @@ wp_simple_event_hook_set_property (GObject * object, guint property_id,
|
|||||||
self->closure = g_value_dup_boxed (value);
|
self->closure = g_value_dup_boxed (value);
|
||||||
g_closure_sink (self->closure);
|
g_closure_sink (self->closure);
|
||||||
if (G_CLOSURE_NEEDS_MARSHAL (self->closure))
|
if (G_CLOSURE_NEEDS_MARSHAL (self->closure))
|
||||||
g_closure_set_marshal (self->closure, g_cclosure_marshal_VOID__BOXED);
|
g_closure_set_marshal (self->closure, g_cclosure_marshal_generic);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
@@ -442,17 +442,12 @@ wp_simple_event_hook_run (WpEventHook * hook,
|
|||||||
GAsyncReadyCallback callback, gpointer callback_data)
|
GAsyncReadyCallback callback, gpointer callback_data)
|
||||||
{
|
{
|
||||||
WpSimpleEventHook *self = WP_SIMPLE_EVENT_HOOK (hook);
|
WpSimpleEventHook *self = WP_SIMPLE_EVENT_HOOK (hook);
|
||||||
g_autoptr (WpEventDispatcher) dispatcher =
|
|
||||||
wp_event_hook_get_dispatcher (hook);
|
|
||||||
|
|
||||||
GValue values[2] = { G_VALUE_INIT, G_VALUE_INIT };
|
GValue values[2] = { G_VALUE_INIT };
|
||||||
g_value_init (&values[0], G_TYPE_OBJECT);
|
g_value_init (&values[0], WP_TYPE_EVENT);
|
||||||
g_value_init (&values[1], WP_TYPE_EVENT);
|
g_value_set_boxed (&values[0], event);
|
||||||
g_value_set_object (&values[0], dispatcher);
|
g_closure_invoke (self->closure, NULL, 1, values, NULL);
|
||||||
g_value_set_boxed (&values[1], event);
|
|
||||||
g_closure_invoke (self->closure, NULL, 2, values, NULL);
|
|
||||||
g_value_unset (&values[0]);
|
g_value_unset (&values[0]);
|
||||||
g_value_unset (&values[1]);
|
|
||||||
|
|
||||||
callback ((GObject *) self, NULL, callback_data);
|
callback ((GObject *) self, NULL, callback_data);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ test_events_teardown (TestFixture *self, gconstpointer user_data)
|
|||||||
|
|
||||||
#define HOOK_FUNC(x) \
|
#define HOOK_FUNC(x) \
|
||||||
static void \
|
static void \
|
||||||
hook_##x (WpEventDispatcher * dispatcher, WpEvent * event, TestFixture * self) \
|
hook_##x (WpEvent * event, TestFixture * self) \
|
||||||
{ \
|
{ \
|
||||||
g_debug ("in hook_" #x); \
|
g_debug ("in hook_" #x); \
|
||||||
g_ptr_array_add (self->hooks_executed, hook_##x); \
|
g_ptr_array_add (self->hooks_executed, hook_##x); \
|
||||||
@@ -43,7 +43,7 @@ HOOK_FUNC(c)
|
|||||||
HOOK_FUNC(d)
|
HOOK_FUNC(d)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hook_quit (WpEventDispatcher * dispatcher, WpEvent * event, TestFixture * self)
|
hook_quit (WpEvent * event, TestFixture * self)
|
||||||
{
|
{
|
||||||
g_debug ("in hook_quit");
|
g_debug ("in hook_quit");
|
||||||
g_ptr_array_add (self->hooks_executed, hook_quit);
|
g_ptr_array_add (self->hooks_executed, hook_quit);
|
||||||
|
Reference in New Issue
Block a user