[gtk+/wip/baedert/gtkimageview: 162/228] GtkImageView: Don't crash on scroll-events if !image_surface



commit dcf2ed74bc3c994d86ec71c36967db245235142f
Author: Timm Bäder <mail baedert org>
Date:   Mon Jan 25 16:49:12 2016 +0100

    GtkImageView: Don't crash on scroll-events if !image_surface

 gtk/gtkimageview.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 9b4e544..af3a246 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -1578,11 +1578,14 @@ gtk_image_view_scroll_event (GtkWidget       *widget,
   double new_scale = priv->scale - (0.1 * event->delta_y);
   State state;
 
+  if (!priv->image_surface)
+    return GDK_EVENT_PROPAGATE;
+
   gtk_image_view_get_current_state (image_view, &state);
 
   gtk_image_view_set_scale_internal (image_view, new_scale);
 
-  if (priv->hadjustment != NULL && priv->vadjustment != NULL)
+  if (priv->hadjustment && priv->vadjustment)
     {
       gtk_image_view_fix_anchor (image_view,
                                  event->x,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]