From 727a7dbf461b48b2c35c5a94bd61ce5996b92a92 Mon Sep 17 00:00:00 2001 From: "10:33:41 Tim Janik" Date: Tue, 27 May 2008 08:35:24 +0000 Subject: [PATCH] guard gtk_widget_get_snapshot() against invalid or invisible widgets. 2008-05-27 10:33:41 Tim Janik * gtk/gtkwidget.c: guard gtk_widget_get_snapshot() against invalid or invisible widgets. svn path=/trunk/; revision=20187 --- ChangeLog | 5 +++++ gtk/gtkwidget.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 52cd7261e2..d2beae749c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-27 10:33:41 Tim Janik + + * gtk/gtkwidget.c: guard gtk_widget_get_snapshot() against + invalid or invisible widgets. + 2008-05-27 Matthias Clasen Bug 531008 – Crash in gtkprintunixdialog.c diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 171be8525c..7496c00c88 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -8356,6 +8356,10 @@ gtk_widget_get_snapshot (GtkWidget *widget, GdkPixmap *pixmap; GList *windows = NULL, *list; + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + if (!GTK_WIDGET_VISIBLE (widget)) + return NULL; + /* the widget (and parent_window) must be realized to be drawable */ if (widget->parent && !GTK_WIDGET_REALIZED (widget->parent)) gtk_widget_realize (widget->parent);