From 89ceb1e27afed0bac789e33c2f10eade01747d88 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Fri, 29 Apr 2016 22:12:09 +0200
Subject: Fixed various usages of uninitialised memory.

---
 ChangeLog                   |  8 ++++++++
 src/gtkext/gtkbufferview.c  | 18 ++++++++++++++----
 src/gtkext/gtkdockstation.c |  2 +-
 src/gtkext/gtkgraphview.c   | 22 ++++++++++++++++------
 src/gtkext/gtkstatusstack.c |  1 +
 5 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ef46977..13320d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 16-04-29  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/gtkext/gtkbufferview.c:
+	* src/gtkext/gtkdockstation.c:
+	* src/gtkext/gtkgraphview.c:
+	* src/gtkext/gtkstatusstack.c:
+	Fix various usages of uninitialised memory.
+
+16-04-29  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/analysis/disass/disassembler.c:
 	Enable once again the CFG analysis.
 
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index f775de5..b56a170 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -660,11 +660,21 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y,
 
 static void gtk_buffer_view_compute_requested_size(GtkBufferView *view, gint *width, gint *height)
 {
-    if (width != NULL && view->buffer_view != NULL)
-        *width = g_buffer_view_get_width(view->buffer_view, GTK_VIEW_PANEL(view)->display);
+    if (width != NULL)
+    {
+        if (view->buffer_view != NULL)
+            *width = g_buffer_view_get_width(view->buffer_view, GTK_VIEW_PANEL(view)->display);
+        else
+            *width = 0;
+    }
 
-    if (height != NULL && view->buffer_view != NULL)
-        *height = g_buffer_view_get_height(view->buffer_view);
+    if (height != NULL)
+    {
+        if (view->buffer_view != NULL)
+            *height = g_buffer_view_get_height(view->buffer_view);
+        else
+            *height = 0;
+    }
 
 }
 
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c
index 2061a4b..cc567ad 100644
--- a/src/gtkext/gtkdockstation.c
+++ b/src/gtkext/gtkdockstation.c
@@ -266,7 +266,7 @@ void gtk_dock_station_add_dockable(GtkDockStation *station, GtkDockable *dockabl
     GtkWidget *widget;                      /* Composant GTK à intégrer    */
     const char *caption;                    /* Nom à donner à l'onglet     */
     const char *desc;                       /* Description à y associer    */
-    size_t max;                             /* Taille maximale des titres  */
+    int max;                                /* Taille maximale des titres  */
     char *str;                              /* Titre des prochaines fois   */
     GtkWidget *label;                       /* Etiquette d'onglet          */
     GtkNotebook *notebook;                  /* Autre version du composant  */
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index a2c0cd3..0c680fa 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -206,16 +206,26 @@ static void gtk_graph_view_compute_requested_size(GtkGraphView *view, gint *widt
 {
     GtkRequisition requisition;             /* Taille requise              */
 
-    if (width != NULL && view->layout != NULL)
+    if (width != NULL)
     {
-        g_graph_layout_size_request(view->layout, &requisition);
-        *width = requisition.width;
+        if (view->layout != NULL)
+        {
+            g_graph_layout_size_request(view->layout, &requisition);
+            *width = requisition.width;
+        }
+        else
+            *width = 0;
     }
 
-    if (height != NULL && view->layout != NULL)
+    if (height != NULL)
     {
-        g_graph_layout_size_request(view->layout, &requisition);
-        *height = requisition.height;
+        if (view->layout != NULL)
+        {
+            g_graph_layout_size_request(view->layout, &requisition);
+            *height = requisition.height;
+        }
+        else
+            *height = 0;
     }
 
 }
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c
index f8bb4e8..d84f179 100644
--- a/src/gtkext/gtkstatusstack.c
+++ b/src/gtkext/gtkstatusstack.c
@@ -862,6 +862,7 @@ activity_id_t gtk_status_stack_add_activity(GtkStatusStack *stack, const char *m
 
     info->statuses[new].current = 0;
     info->statuses[new].max = max;
+    info->statuses[new].last_updated = 0;
 
     /* Actualisation */
 
-- 
cgit v0.11.2-87-g4458