[gtk+/wip/baedert/gtkimageview: 226/279] GtkImageView: Don't crash if the scale is set, but image_surface isn't



commit 879f884b0fba56f6170d5c4fd20b3da82b7d06a9
Author: Timm Bäder <mail baedert org>
Date:   Wed Jan 27 18:09:51 2016 +0100

    GtkImageView: Don't crash if the scale is set, but image_surface isn't

 gtk/gtkimageview.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 7a77426..01ea2c8 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -1149,8 +1149,6 @@ gtk_image_view_set_scale (GtkImageView *image_view,
   g_return_if_fail (GTK_IS_IMAGE_VIEW (image_view));
   g_return_if_fail (scale > 0.0);
 
-  g_message ("New scale: %f", scale);
-
   gtk_image_view_get_current_state (image_view, &state);
 
   priv->scale = scale;
@@ -1174,6 +1172,10 @@ gtk_image_view_set_scale (GtkImageView *image_view,
   priv->size_valid = FALSE;
   gtk_image_view_update_adjustments (image_view);
 
+  if (!priv->image_surface)
+    return;
+
+
   if (priv->hadjustment != NULL && priv->vadjustment != NULL)
     {
       int pointer_x = gtk_widget_get_allocated_width (GTK_WIDGET (image_view)) / 2;


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