widget: Add a defualt snapshot vfunc

Just to avoid having to do NULL checks when calling
widget_class->snapshot. We were crashing with drawing areas who don't
have a draw or a snapshot vfunc (woot!).
This commit is contained in:
Benjamin Otte 2016-11-18 00:46:49 +01:00
parent f8f2b8144f
commit efa1c6cbd5

View File

@ -949,6 +949,13 @@ gtk_widget_draw_marshallerv (GClosure *closure,
va_end (args_copy);
}
static void
gtk_widget_real_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
/* nothing to do here */
}
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
@ -1013,6 +1020,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->grab_notify = NULL;
klass->child_notify = NULL;
klass->draw = NULL;
klass->snapshot = gtk_widget_real_snapshot;
klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
klass->grab_focus = gtk_widget_real_grab_focus;
klass->focus = gtk_widget_real_focus;