From 2b4b5dc1683d33339a24e9ab5e415ebd6589cb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Mon, 18 Jul 2016 17:24:40 +0200 Subject: [PATCH] Fixed some crashes on the indicator. --- src/AyatanaIndicator.vala | 22 ++++++++++------------ src/IndicatorObject.vala | 5 ----- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/AyatanaIndicator.vala b/src/AyatanaIndicator.vala index 076bef7..b83b415 100644 --- a/src/AyatanaIndicator.vala +++ b/src/AyatanaIndicator.vala @@ -33,25 +33,23 @@ public class AyatanaCompatibility.Indicator : Wingpanel.Indicator { const int MAX_ICON_SIZE = 24; public Indicator (IndicatorAyatana.ObjectEntry entry, IndicatorAyatana.Object obj, IndicatorIface indicator) { - Object (code_name: "%s%s".printf ("ayatana-", entry.name_hint), - display_name: "%s%s".printf ("ayatana-", entry.name_hint), + string name_hint = entry.name_hint; + if (name_hint == null) { + var rand = new GLib.Rand (); + name_hint = rand.next_int ().to_string (); + } + + Object (code_name: "%s%s".printf ("ayatana-", name_hint), + display_name: "%s%s".printf ("ayatana-", name_hint), description: _("Ayatana compatibility indicator")); this.entry = entry; this.indicator = indicator; this.parent_object = obj; this.menu_map = new Gee.HashMap (); - - unowned string name_hint = entry.name_hint; - - if (name_hint == null) { - warning ("NULL name hint"); - } - - entry_name_hint = name_hint != null ? name_hint.dup () : ""; + entry_name_hint = name_hint; if (entry.menu == null) { critical ("Indicator: %s has no menu widget.", entry_name_hint); - return; } @@ -325,4 +323,4 @@ public class AyatanaCompatibility.Indicator : Wingpanel.Indicator { MAX_ICON_SIZE, Gdk.InterpType.HYPER); } } -} \ No newline at end of file +} diff --git a/src/IndicatorObject.vala b/src/IndicatorObject.vala index 44a8cad..76e1c66 100644 --- a/src/IndicatorObject.vala +++ b/src/IndicatorObject.vala @@ -32,11 +32,6 @@ public class AyatanaCompatibility.IndicatorObject : Object, IndicatorIface { object.entry_removed.connect (on_entry_removed); } - ~IndicatorObject () { - object.entry_added.disconnect (on_entry_added); - object.entry_removed.disconnect (on_entry_removed); - } - public string get_name () { return name; }