Bug 551722 – gtk_widget_set_scroll_adjustments() should check the signal

2008-09-17  Matthias Clasen  <mclasen@redhat.com>

        Bug 551722 – gtk_widget_set_scroll_adjustments() should check the
        signal signature

        * gtk/gtkwidget.c (gtk_widget_set_scroll_adjustments): Check the
        signature of the signal. Patch by Christian Persch


svn path=/trunk/; revision=21410
This commit is contained in:
Matthias Clasen 2008-09-17 15:07:32 +00:00 committed by Matthias Clasen
parent fcaf65b8ad
commit ed877089bd
2 changed files with 30 additions and 9 deletions

View File

@ -1,3 +1,11 @@
2008-09-17 Matthias Clasen <mclasen@redhat.com>
Bug 551722 gtk_widget_set_scroll_adjustments() should check the
signal signature
* gtk/gtkwidget.c (gtk_widget_set_scroll_adjustments): Check the
signature of the signal. Patch by Christian Persch
2008-09-16 Michael Natterer <mitch@imendio.com>
* gtk/gtkwidget.c (_gtk_widget_set,get_pointer_window): don't

View File

@ -4800,22 +4800,35 @@ gtk_widget_set_scroll_adjustments (GtkWidget *widget,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment)
{
guint signal_id;
GSignalQuery query;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (hadjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadjustment), FALSE);
if (vadjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadjustment), FALSE);
if (WIDGET_CLASS (widget)->set_scroll_adjustments_signal)
{
/* FIXME: we should eventually check the signals signature here */
g_signal_emit (widget,
WIDGET_CLASS (widget)->set_scroll_adjustments_signal, 0,
hadjustment, vadjustment);
return TRUE;
}
else
signal_id = WIDGET_CLASS (widget)->set_scroll_adjustments_signal;
if (!signal_id)
return FALSE;
g_signal_query (signal_id, &query);
if (!query.signal_id ||
!g_type_is_a (query.itype, GTK_TYPE_WIDGET) ||
query.return_type != G_TYPE_NONE ||
query.n_params != 2 ||
query.param_types[0] != GTK_TYPE_ADJUSTMENT ||
query.param_types[1] != GTK_TYPE_ADJUSTMENT)
{
g_warning (G_STRLOC ": signal \"%s::%s\" has wrong signature",
G_OBJECT_TYPE_NAME (widget), query.signal_name);
return FALSE;
}
g_signal_emit (widget, signal_id, 0, hadjustment, vadjustment);
return TRUE;
}
static void