[gnome-panel] actually, don't leak the proxy.
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] actually, don't leak the proxy.
- Date: Thu, 31 Mar 2011 13:10:40 +0000 (UTC)
commit 5e4540b9e09cf0b920f0c3c74cf0fdfaf0faaba5
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Mar 31 18:36:22 2011 +0530
actually, don't leak the proxy.
applets/clock/clock-location.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c
index 5735b98..1e65e04 100644
--- a/applets/clock/clock-location.c
+++ b/applets/clock/clock-location.c
@@ -740,23 +740,24 @@ network_monitor_signal (GDBusProxy *proxy,
static void
setup_network_monitor (void)
{
+ static GDBusProxy *proxy;
GError *error = NULL;
- GDBusProxy *proxy;
- proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
- NULL, NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE,
- NULL, &error);
+ if (proxy == NULL) {
+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ NULL, NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE,
+ NULL, &error);
+
+ if (proxy == NULL) {
+ g_warning ("Couldn't create NetworkManager proxy: %s",
+ error->message);
+ g_error_free (error);
+ return;
+ }
- if (proxy == NULL) {
- g_warning ("Couldn't create NetworkManager proxy: %s",
- error->message);
- g_error_free (error);
- return;
+ g_signal_connect (proxy, "g-signal", G_CALLBACK (network_monitor_signal), NULL);
}
-
- g_signal_connect (proxy, "g-signal", G_CALLBACK (network_monitor_signal), NULL);
- /* leak the proxy */
}
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]