summaryrefslogtreecommitdiff
path: root/libmate-panel-applet/mate-panel-applet-factory.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2017-07-18 14:54:35 -0400
committerlukefromdc <[email protected]>2017-08-13 14:37:24 -0400
commit9ed5f0a3dc01abff7f14b8a6f70589c555f7a11e (patch)
treeca893a34cd45d53aca8ec14221b77d0602c6350a /libmate-panel-applet/mate-panel-applet-factory.c
parentda61744ebf10b2517672449e8a8c2eb03e1f3879 (diff)
downloadmate-panel-9ed5f0a3dc01abff7f14b8a6f70589c555f7a11e.tar.bz2
mate-panel-9ed5f0a3dc01abff7f14b8a6f70589c555f7a11e.tar.xz
libmate-panel-applet: unown bus name and unregister dbus object
Fix for crashes on removing applets similar to https://bugzilla.gnome.org/show_bug.cgi?id=692610
Diffstat (limited to 'libmate-panel-applet/mate-panel-applet-factory.c')
-rw-r--r--libmate-panel-applet/mate-panel-applet-factory.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libmate-panel-applet/mate-panel-applet-factory.c b/libmate-panel-applet/mate-panel-applet-factory.c
index cf2e6cba..370a4124 100644
--- a/libmate-panel-applet/mate-panel-applet-factory.c
+++ b/libmate-panel-applet/mate-panel-applet-factory.c
@@ -33,6 +33,10 @@ struct _MatePanelAppletFactory {
GType applet_type;
GClosure *closure;
+ GDBusConnection *connection;
+ gint owner_id;
+ gint registration_id;
+
GHashTable *applets;
guint next_uid;
};
@@ -53,6 +57,16 @@ mate_panel_applet_factory_finalize (GObject *object)
{
MatePanelAppletFactory *factory = MATE_PANEL_APPLET_FACTORY (object);
+ if (factory->registration_id) {
+ g_dbus_connection_unregister_object (factory->connection, factory->registration_id);
+ factory->registration_id = 0;
+ }
+
+ if (factory->owner_id) {
+ g_bus_unown_name (factory->owner_id);
+ factory->owner_id = 0;
+ }
+
g_hash_table_remove (factories, factory->factory_id);
if (g_hash_table_size (factories) == 0) {
@@ -295,7 +309,7 @@ mate_panel_applet_factory_register_service (MatePanelAppletFactory *factory)
gchar *service_name;
service_name = g_strdup_printf (MATE_PANEL_APPLET_FACTORY_SERVICE_NAME, factory->factory_id);
- g_bus_own_name (G_BUS_TYPE_SESSION,
+ factory->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
service_name,
G_BUS_NAME_OWNER_FLAGS_NONE,
(GBusAcquiredCallback) on_bus_acquired,