[gedit] Unown the bus name to release some memory
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Unown the bus name to release some memory
- Date: Sat, 18 Feb 2012 10:04:27 +0000 (UTC)
commit a4070962283336bf9ddeadb2926c7e68592e9574
Author: Daniel Trebbien <dtrebbien gmail com>
Date: Fri Feb 17 12:37:55 2012 -0500
Unown the bus name to release some memory
g_bus_unown_name() should be called to unown the bus name that is obtained
by gedit_dbus_run().
https://bugzilla.gnome.org/show_bug.cgi?id=670307
gedit/gedit-dbus.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-dbus.c b/gedit/gedit-dbus.c
index 6fc569e..eaa040a 100644
--- a/gedit/gedit-dbus.c
+++ b/gedit/gedit-dbus.c
@@ -99,6 +99,7 @@ typedef struct
struct _GeditDBusPrivate
{
+ guint owner_id;
GeditDBusResult result;
GMainLoop *main_loop;
guint32 wait_id;
@@ -174,6 +175,12 @@ gedit_dbus_dispose (GObject *object)
g_clear_object (&dbus->priv->stdin_in_stream);
#endif
+ if (dbus->priv->owner_id != 0)
+ {
+ g_bus_unown_name (dbus->priv->owner_id);
+ dbus->priv->owner_id = 0;
+ }
+
G_OBJECT_CLASS (gedit_dbus_parent_class)->dispose (object);
}
@@ -1678,16 +1685,18 @@ gedit_dbus_run (GeditDBus *dbus)
dbus->priv->main_loop = g_main_loop_new (NULL, FALSE);
- g_bus_own_name (G_BUS_TYPE_SESSION,
- "org.gnome.gedit",
- G_BUS_NAME_OWNER_FLAGS_NONE,
- (GBusAcquiredCallback)bus_acquired_cb,
- (GBusNameAcquiredCallback)name_acquired_cb,
- (GBusNameLostCallback)name_lost_cb,
- dbus,
- NULL);
-
- gedit_debug_message (DEBUG_DBUS, "Own name org.gnome.gedit\n");
+ dbus->priv->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+ "org.gnome.gedit",
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ (GBusAcquiredCallback)bus_acquired_cb,
+ (GBusNameAcquiredCallback)name_acquired_cb,
+ (GBusNameLostCallback)name_lost_cb,
+ dbus,
+ NULL);
+
+ gedit_debug_message (DEBUG_DBUS,
+ "Own name org.gnome.gedit (owner_id = %d)",
+ dbus->priv->owner_id);
g_main_loop_run (dbus->priv->main_loop);
g_main_loop_unref (dbus->priv->main_loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]