[gtk+] widget: Print a g_warning() when a cairo_t is invalid
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Print a g_warning() when a cairo_t is invalid
- Date: Thu, 22 Dec 2011 23:27:27 +0000 (UTC)
commit 8a83f0c2d1443f6bedeec35b6b75a5f883fc52a5
Author: Benjamin Otte <otte redhat com>
Date: Tue Dec 20 15:34:57 2011 +0100
widget: Print a g_warning() when a cairo_t is invalid
Only print the warning on internal code, so we aren't too verbose.
gtk/gtkwidget.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ff7ede3..fe790f9 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5724,6 +5724,19 @@ _gtk_widget_draw_internal (GtkWidget *widget,
g_signal_emit (widget, widget_signals[DRAW],
0, cr,
&result);
+
+ if (cairo_status (cr) &&
+ _gtk_cairo_get_event (cr))
+ {
+ /* We check the event so we only warn about internal GTK calls.
+ * Errors might come from PDF streams having write failures and
+ * we don't want to spam stderr in that case.
+ * We do want to catch errors from
+ */
+ g_warning ("drawing failure for widget `%s': %s",
+ G_OBJECT_TYPE_NAME (widget),
+ cairo_status_to_string (cairo_status (cr)));
+ }
}
context = gtk_widget_get_style_context (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]