[gnome-photos] gegl: Limit the scope of the GError
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] gegl: Limit the scope of the GError
- Date: Mon, 4 Dec 2017 14:58:04 +0000 (UTC)
commit 3c8578917a642f460f9ff6bb13c1b760ffcc2b5f
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Dec 3 15:57:18 2017 +0100
gegl: Limit the scope of the GError
Even though it's not strictly necessary here, it's a good style to
follow. It reduces the chances of re-using the same GError without
ensuring that it is empty, and emphasizes that g_task_return_error
assumes ownership of the GError.
src/photos-gegl.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/photos-gegl.c b/src/photos-gegl.c
index 8038c7d..8e80028 100644
--- a/src/photos-gegl.c
+++ b/src/photos-gegl.c
@@ -436,7 +436,6 @@ photos_gegl_buffer_zoom_in_thread_func (GTask *task,
{
GeglBuffer *buffer = GEGL_BUFFER (source_object);
g_autoptr (GeglBuffer) result = NULL;
- GError *error;
const gchar *zoom_str = (const gchar *) task_data;
gchar *endptr;
gdouble zoom;
@@ -444,13 +443,16 @@ photos_gegl_buffer_zoom_in_thread_func (GTask *task,
zoom = g_ascii_strtod (zoom_str, &endptr);
g_assert (*endptr == '\0');
- error = NULL;
- result = photos_gegl_buffer_zoom (buffer, zoom, cancellable, &error);
- if (error != NULL)
- {
- g_task_return_error (task, error);
- goto out;
- }
+ {
+ g_autoptr (GError) error = NULL;
+
+ result = photos_gegl_buffer_zoom (buffer, zoom, cancellable, &error);
+ if (error != NULL)
+ {
+ g_task_return_error (task, g_steal_pointer (&error));
+ goto out;
+ }
+ }
g_task_return_pointer (task, g_object_ref (result), g_object_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]