[gnome-calendar] event-widget: avoid crash when retrieving the DnD pixbuf
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: avoid crash when retrieving the DnD pixbuf
- Date: Wed, 6 Jul 2016 18:57:08 +0000 (UTC)
commit 7844122dd2b8787d875b0f6eefdcbdc95673370c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jul 6 15:55:13 2016 -0300
event-widget: avoid crash when retrieving the DnD pixbuf
Since we're storing the GdkWindow relative to the event widget,
it's usually safer to create a pixbuf of the widget *after* it's
drawn, and not while it's being drawed.
This commit moves the pixbuf retrieval code to the draw-begin
implementation, so we only create the pixbuf when actually
using it.
src/gcal-event-widget.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 93ef996..794a278 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -577,15 +577,6 @@ gcal_event_widget_draw (GtkWidget *widget,
cairo_paint (cr);
}
- /* Setup the drag n' drop icon */
- g_clear_object (&self->dnd_pixbuf);
-
- self->dnd_pixbuf = gdk_pixbuf_get_from_window (self->event_window,
- 0,
- 0,
- width,
- height);
-
pango_font_description_free (font_desc);
g_object_unref (layout);
g_free (display_text);
@@ -629,6 +620,15 @@ gcal_event_widget_drag_begin (GtkWidget *widget,
{
GcalEventWidget *self = GCAL_EVENT_WIDGET (widget);
+ /* Setup the drag n' drop icon */
+ g_clear_object (&self->dnd_pixbuf);
+
+ self->dnd_pixbuf = gdk_pixbuf_get_from_window (self->event_window,
+ 0,
+ 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+
gtk_drag_set_icon_pixbuf (context, self->dnd_pixbuf, 0, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]