From ae42314dc1118ef6ad2da5396aa01b46aba40c3e Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Thu, 10 Dec 2015 00:05:31 +0100
Subject: Fixed a bug by ensuring a Cairo surface is defined before painting
 it.

---
 ChangeLog                 |  5 +++++
 src/glibext/gbufferline.c | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f3c0d37..6e1f813 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+15-12-10  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/glibext/gbufferline.c:
+	Fix a bug by ensuring a Cairo surface is defined before painting it.
+
 15-12-09  Cyrille Bagard <nocbos@gmail.com>
 
 	* src/glibext/gbufferline.c:
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index 4f021fa..2680dae 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -1470,6 +1470,7 @@ void g_buffer_line_remove_flag(GBufferLine *line, BufferLineFlags flag)
 void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const gint max_widths[BLC_COUNT], gint x_init, gint y, const bool *display, const segcnt_list *list)
 {
     GBufferLineClass *class;                /* Stockage de briques de base */
+    bool has_src_surface;                   /* Note une présence définie   */
     gint x;                                 /* Point de départ d'impression*/
     BufferLineColumn i;                     /* Boucle de parcours          */
     gint max_width;                         /* Largeur maximale de colonne */
@@ -1479,11 +1480,20 @@ void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const gint max_widths
         class = G_BUFFER_LINE_GET_CLASS(line);
 
         if (line->flags & BLF_ENTRYPOINT)
+        {
             cairo_set_source_surface(cairo, class->entrypoint_img, 5, y);
+            has_src_surface = true;
+        }
         else if (line->flags & BLF_BOOKMARK)
+        {
             cairo_set_source_surface(cairo, class->bookmark_img, 5, y);
+            has_src_surface = true;
+        }
+        else
+            has_src_surface = false;
 
-        cairo_paint(cairo);
+        if (has_src_surface)
+            cairo_paint(cairo);
 
     }
 
-- 
cgit v0.11.2-87-g4458