diff options
author | Richard Hughes <richard@hughsie.com> | 2015-10-13 16:43:21 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-10-13 16:57:00 +0100 |
commit | 07c265ef6cf8fe6604472a15987040938433f129 (patch) | |
tree | 9a5635b55d57698c37c2dbbba791834b0dfa5437 /contrib/session-helper | |
parent | d1c8abfd482310fdb3bdbb7464216f7f61e221b7 (diff) | |
download | colord-07c265ef6cf8fe6604472a15987040938433f129.tar.gz |
Use g_autoptr() in more places
Diffstat (limited to 'contrib/session-helper')
-rw-r--r-- | contrib/session-helper/cd-example.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/contrib/session-helper/cd-example.c b/contrib/session-helper/cd-example.c index 5ad22cc..ba43512 100644 --- a/contrib/session-helper/cd-example.c +++ b/contrib/session-helper/cd-example.c @@ -254,7 +254,7 @@ cd_example_signal_cb (GDBusProxy *proxy, const gchar *profile_path = NULL; const gchar *str = NULL; gboolean ret; - GError *error = NULL; + g_autoptr(GError) error = NULL; GPtrArray *array = NULL; GtkImage *img; GtkLabel *label; @@ -327,7 +327,6 @@ cd_example_signal_cb (GDBusProxy *proxy, if (!ret) { g_warning ("failed to update gamma: %s", error->message); - g_error_free (error); goto out; } goto out; @@ -402,7 +401,7 @@ cd_example_window_state_cb (GtkWidget *widget, CdExamplePrivate *priv) { gboolean ret; - GError *error = NULL; + g_autoptr(GError) error = NULL; GdkEventWindowState *event_state = (GdkEventWindowState *) event; GtkWindow *window = GTK_WINDOW (widget); @@ -417,10 +416,8 @@ cd_example_window_state_cb (GtkWidget *widget, priv->device, &error); - if (!ret) { + if (!ret) g_warning ("Failed to resize window: %s", error->message); - g_error_free (error); - } return TRUE; } @@ -431,7 +428,7 @@ static void cd_example_button_start_cb (GtkWidget *widget, CdExamplePrivate *priv) { GVariant *retval; - GError *error = NULL; + g_autoptr(GError) error = NULL; /* continue */ retval = g_dbus_proxy_call_sync (priv->proxy, @@ -475,7 +472,7 @@ main (int argc, char **argv) gchar *title = NULL; GDBusConnection *connection = NULL; gdouble gamma = 2.2f; - GError *error = NULL; + g_autoptr(GError) error = NULL; gint retval = EXIT_FAILURE; GOptionContext *context; GtkBox *box; @@ -698,7 +695,6 @@ out: g_print ("%s: %s\n", "Failed to calibrate", error->message); - g_error_free (error); } g_option_context_free (context); if (priv != NULL) { |