From dc49b249f21c1c8582b9ca8debdd5fbdd15eadae Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 9 Nov 2015 00:08:12 +0000
Subject: Avoided to load the status bar twice and to crash in the worst case.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@605 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                    |  6 ++++++
 plugins/pychrysa/pychrysa.c  | 12 ++++++++++--
 src/gtkext/gtkextstatusbar.c |  7 ++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf48cf0..d9fe98b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+15-11-09  Cyrille Bagard <nocbos@gmail.com>
+
+	* plugins/pychrysa/pychrysa.c:
+	* src/gtkext/gtkextstatusbar.c:
+	Avoid to load the status bar twice and to crash in the worst case.
+
 15-11-04  Cyrille Bagard <nocbos@gmail.com>
 
 	* plugins/pychrysa/analysis/contents/file.c:
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c
index f3acec3..68ab15b 100644
--- a/plugins/pychrysa/pychrysa.c
+++ b/plugins/pychrysa/pychrysa.c
@@ -522,10 +522,18 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
     add_pixmap_directory(PACKAGE_DATA_DIR);
     add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps");
 
-    init_work_queue(NULL/* !! */);
+    /**
+     * On évite d'initialiser deux fois...
+     */
+    if (get_work_queue() != NULL)
+        init_work_queue(NULL/* !! */);
 #endif
 
-    init_work_queue(NULL/* !! */);
+    /**
+     * On évite d'initialiser deux fois...
+     */
+    if (get_work_queue() != NULL)
+        init_work_queue(NULL/* !! */);
 
     ////////////////////////
 
diff --git a/src/gtkext/gtkextstatusbar.c b/src/gtkext/gtkextstatusbar.c
index 74c23bd..8051d41 100644
--- a/src/gtkext/gtkextstatusbar.c
+++ b/src/gtkext/gtkextstatusbar.c
@@ -539,7 +539,9 @@ status_blob_info *init_progessive_status(GtkExtStatusBar *bar, const char *messa
 
     result = (status_blob_info *)calloc(1, sizeof(status_blob_info));
 
-    g_object_ref(G_OBJECT(bar));
+    if (bar != NULL)
+        g_object_ref(G_OBJECT(bar));
+
     result->bar = bar;
 
     result->id = gtk_extended_status_bar_push(bar, message, max > 0.0);
@@ -569,8 +571,7 @@ void fini_progessive_status(status_blob_info *info)
     gtk_extended_status_bar_remove(info->bar, info->id);
 
     if (info->bar != NULL)
-
-    g_object_unref(G_OBJECT(info->bar));
+        g_object_unref(G_OBJECT(info->bar));
 
     free(info);
 
-- 
cgit v0.11.2-87-g4458