From efb6ed3570342e8fcf6458bf3a8f7661078e7ccb Mon Sep 17 00:00:00 2001 From: Steven Luo Date: Wed, 8 Sep 2010 00:20:39 -0700 Subject: [PATCH] Fremantle: Make DBusGProxy static in launch_microb_open_window() Chances are good we'll need to use the D-Bus proxy again at some point, so instead of getting rid of it when launch_microb_open_window() finishes, save it for later use. Has the side effect of fixing a leak when we open a bookmarks window. --- launcher.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/launcher.c b/launcher.c index 7a3c8c1..eb16cf4 100644 --- a/launcher.c +++ b/launcher.c @@ -288,16 +288,18 @@ pid_t launch_microb_start_browser_process(DBusConnection *conn, int fd) { int launch_microb_open_window(struct swb_context *ctx, char *uri, int flags) { - DBusGProxy *g_proxy; + static DBusGProxy *g_proxy = NULL; GError *gerror = NULL; - g_proxy = dbus_g_proxy_new_for_name(ctx->session_bus, - "com.nokia.osso_browser", - "/com/nokia/osso_browser/request", - "com.nokia.osso_browser"); if (!g_proxy) { - log_msg("Couldn't get a com.nokia.osso_browser proxy\n"); - return 0; + g_proxy = dbus_g_proxy_new_for_name(ctx->session_bus, + "com.nokia.osso_browser", + "/com/nokia/osso_browser/request", + "com.nokia.osso_browser"); + if (!g_proxy) { + log_msg("Couldn't get a com.nokia.osso_browser proxy\n"); + return 0; + } } if (!strcmp(uri, "new_window")) { @@ -331,7 +333,6 @@ int launch_microb_open_window(struct swb_context *ctx, char *uri, return 0; } - g_object_unref(g_proxy); return 1; } -- 1.7.9.5