[gthumb] image viewer: fixed crash when hiding the cursor



commit aae601c59a63e14a29560c9f2b169556ef66badd
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Sep 11 10:05:19 2010 +0200

    image viewer: fixed crash when hiding the cursor

 gthumb/gth-image-viewer.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 2a566eb..ac33935 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -340,7 +340,10 @@ gth_image_viewer_realize (GtkWidget *widget)
 
 	self->priv->cursor = gdk_cursor_new (GDK_LEFT_PTR);
 	self->priv->cursor_void = gth_cursor_get (window, GTH_CURSOR_VOID);
-	gdk_window_set_cursor (window, self->priv->cursor);
+	if (self->priv->cursor_visible)
+		gdk_window_set_cursor (window, self->priv->cursor);
+	else
+		gdk_window_set_cursor (window, self->priv->cursor_void);
 
 	if (self->priv->transp_type == GTH_TRANSP_TYPE_NONE) {
 		GdkColor color;
@@ -2269,7 +2272,8 @@ gth_image_viewer_show_cursor (GthImageViewer *self)
 		return;
 
 	self->priv->cursor_visible = TRUE;
-	gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), self->priv->cursor);
+	if (self->priv->cursor != NULL)
+		gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), self->priv->cursor);
 }
 
 
@@ -2280,7 +2284,8 @@ gth_image_viewer_hide_cursor (GthImageViewer *self)
 		return;
 
 	self->priv->cursor_visible = FALSE;
-	gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), self->priv->cursor_void);
+	if (self->priv->cursor_void != NULL)
+		gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), self->priv->cursor_void);
 }
 
 



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