From c8092365591d1336c1e03cf42b6bd6ea58a17350 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sat, 18 Apr 2020 17:30:21 +0200
Subject: Taken into account the potential absence of demangler in the symbol
 panel.

---
 src/format/format.c      |  2 ++
 src/gui/panels/symbols.c | 19 ++++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/format/format.c b/src/format/format.c
index 2be7d5c..18ddc03 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -129,6 +129,8 @@ static void g_binary_format_init(GBinFormat *format)
 
     format->info = g_preload_info_new();
 
+    format->demangler = NULL;
+
     g_rw_lock_init(&format->syms_lock);
 #ifndef NDEBUG
     g_atomic_int_set(&format->sym_locked, 0);
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index 809fed8..2cb2b34 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -61,7 +61,7 @@ struct _GSymbolsPanel
     GPanelItem parent;                      /* A laisser en premier        */
 
     GLoadedBinary *binary;                  /* Binaire à prendre en compte */
-    const char *sep;                        /* Délimitateur à utiliser     */
+    char *sep;                              /* Délimitateur à utiliser     */
 
     size_t count;                           /* Quantité de symboles utiles */
 
@@ -658,6 +658,12 @@ static void change_symbols_panel_current_content(GSymbolsPanel *panel, GLoadedCo
     if (panel->binary != NULL)
         g_object_unref(G_OBJECT(panel->binary));
 
+    if (panel->sep != NULL)
+    {
+        free(panel->sep);
+        panel->sep = NULL;
+    }
+
     panel->binary = binary;
 
     if (panel->binary != NULL)
@@ -676,11 +682,18 @@ static void change_symbols_panel_current_content(GSymbolsPanel *panel, GLoadedCo
     if (binary != NULL)
     {
         format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
+
         demangler = g_binary_format_get_demangler(format);
 
-        panel->sep = g_compiler_demangler_get_ns_separator(demangler);
+        if (demangler == NULL)
+            panel->sep = NULL;
+
+        else
+        {
+            panel->sep = strdup(g_compiler_demangler_get_ns_separator(demangler));
+            g_object_unref(G_OBJECT(demangler));
+        }
 
-        g_object_unref(G_OBJECT(demangler));
         g_object_unref(G_OBJECT(format));
 
         if (panel->sep == NULL)
-- 
cgit v0.11.2-87-g4458