[gnome-session] session-save: Tidy up some GError handling
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] session-save: Tidy up some GError handling
- Date: Fri, 10 Dec 2021 14:53:56 +0000 (UTC)
commit 76db6cd608e5f8448a5161208e4be71d0f84eb77
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Nov 12 16:54:47 2021 +0000
session-save: Tidy up some GError handling
This introduces no functional changes, but makes the code a little
clearer by making the ownership transfer explicit.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
gnome-session/gsm-session-save.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gnome-session/gsm-session-save.c b/gnome-session/gsm-session-save.c
index a71a6181..e7f3653a 100644
--- a/gnome-session/gsm-session-save.c
+++ b/gnome-session/gsm-session-save.c
@@ -68,12 +68,10 @@ save_one_client (char *id,
char *contents = NULL;
gsize length = 0;
char *discard_exec;
- GError *local_error;
+ g_autoptr(GError) local_error = NULL;
client = GSM_CLIENT (object);
- local_error = NULL;
-
app_id = gsm_client_peek_app_id (client);
if (!IS_STRING_EMPTY (app_id)) {
if (g_str_has_suffix (app_id, ".desktop"))
@@ -141,8 +139,7 @@ out:
/* in case of any error, stop saving session */
if (local_error) {
- g_propagate_error (data->error, local_error);
- g_error_free (local_error);
+ g_propagate_error (data->error, g_steal_pointer (&local_error));
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]