[gnome-panel/gtk3] panel: Do not unref GAppInfo if there was an error when creating it
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3] panel: Do not unref GAppInfo if there was an error when creating it
- Date: Mon, 31 Jan 2011 23:45:18 +0000 (UTC)
commit ac5c8c291a801fd7f7ba133b11740c350ea8a0e3
Author: Vincent Untz <vuntz gnome org>
Date: Mon Jan 31 18:58:16 2011 +0100
panel: Do not unref GAppInfo if there was an error when creating it
Also move some code around in the function.
gnome-panel/panel-action-button.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gnome-panel/panel-action-button.c b/gnome-panel/panel-action-button.c
index 189f56f..f1b6f32 100644
--- a/gnome-panel/panel-action-button.c
+++ b/gnome-panel/panel-action-button.c
@@ -238,11 +238,9 @@ panel_action_force_quit (GtkWidget *widget)
static void
panel_action_connect_server (GtkWidget *widget)
{
- GdkScreen *screen;
- GdkAppLaunchContext *launch_context;
- GAppInfo *app_info;
- GError *error;
- GdkDisplay *display;
+ GdkScreen *screen;
+ GAppInfo *app_info;
+ GError *error;
screen = gtk_widget_get_screen (GTK_WIDGET (widget));
error = NULL;
@@ -252,12 +250,19 @@ panel_action_connect_server (GtkWidget *widget)
&error);
if (!error) {
+ GdkAppLaunchContext *launch_context;
+ GdkDisplay *display;
+
display = gdk_screen_get_display (screen);
launch_context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_screen (launch_context, screen);
- g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error);
+
+ g_app_info_launch (app_info, NULL,
+ G_APP_LAUNCH_CONTEXT (launch_context),
+ &error);
g_object_unref (launch_context);
+ g_object_unref (app_info);
}
if (error) {
@@ -268,8 +273,6 @@ panel_action_connect_server (GtkWidget *widget)
error->message);
g_clear_error (&error);
}
-
- g_object_unref (app_info);
}
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]