[gnome-panel/wip/segeiger/fish-add-gdbus-connection: 2/2] free-the-fish.c: Avoid drawing with cairo if the fish has no window



commit 59b71d53eeb7476392d39b0120f4ee04d03d3d4b
Author: Sebastian Geiger <sbastig gmx net>
Date:   Wed Jun 10 14:50:15 2015 +0200

    free-the-fish.c: Avoid drawing with cairo if the fish has no window
    
    This prevents a segfault if cr is null.

 gnome-panel/free-the-fish.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/free-the-fish.c b/gnome-panel/free-the-fish.c
index 8de29f8..1ef2db0 100644
--- a/gnome-panel/free-the-fish.c
+++ b/gnome-panel/free-the-fish.c
@@ -80,10 +80,12 @@ fish_draw (int orient, int frame)
         shape_offset = orient ? -frame : frame + 1 - FISH_FRAMES;
 
         cr = gdk_cairo_create (fish.window);
-        cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-        cairo_set_source (cr, pattern);
-        cairo_paint (cr);
-        cairo_destroy (cr);
+        if (cr) {
+            cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+            cairo_set_source (cr, pattern);
+            cairo_paint (cr);
+            cairo_destroy (cr);
+        }
 
         /* Yes. Don't ask. */
         gdk_window_set_background_pattern (fish.window, pattern);


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