Ver código fonte

Fix incorrectly freeing GError

Benjamin Schaaf 3 anos atrás
pai
commit
c277342f74
3 arquivos alterados com 7 adições e 3 exclusões
  1. 2 2
      src/flash.c
  2. 4 1
      src/main.c
  3. 1 0
      src/process_pipeline.c

+ 2 - 2
src/flash.c

@@ -60,7 +60,7 @@ dbus_brightness_init(GObject *src, GAsyncResult *res, gpointer *user_data)
         if (!dbus_brightness_proxy || err) {
                 printf("Failed to connect to dbus brightness service %s\n",
                        err->message);
-                g_object_unref(err);
+                g_error_free(err);
                 return;
         }
 }
@@ -145,7 +145,7 @@ brightness_received(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data)
 
         if (!result) {
                 printf("Failed to get display brightness: %s\n", error->message);
-                g_object_unref(error);
+                g_error_free(error);
                 return;
         }
 

+ 4 - 1
src/main.c

@@ -500,6 +500,7 @@ run_open_last_action(GSimpleAction *action, GVariant *param, gpointer user_data)
                 g_printerr("Could not launch image viewer for '%s': %s\n",
                            uri,
                            error->message);
+                g_error_free(error);
         }
 }
 
@@ -511,6 +512,7 @@ run_open_photos_action(GSimpleAction *action, GVariant *param, gpointer user_dat
         sprintf(uri, "file://%s", g_get_user_special_dir(G_USER_DIRECTORY_PICTURES));
         if (!g_app_info_launch_default_for_uri(uri, NULL, &error)) {
                 g_printerr("Could not launch image viewer: %s\n", error->message);
+                g_error_free(error);
         }
 }
 
@@ -577,6 +579,7 @@ on_zbar_dialog_response(GtkDialog *dialog, int response, char *data)
                 if (!g_app_info_launch_default_for_uri(data, NULL, &error)) {
                         g_printerr("Could not launch application: %s\n",
                                    error->message);
+                        g_error_free(error);
                 }
         case GTK_RESPONSE_ACCEPT: {
                 GdkDisplay *display = gtk_widget_get_display(GTK_WIDGET(dialog));
@@ -927,7 +930,7 @@ display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_
 
         if (!result) {
                 printf("Failed to get display configuration: %s\n", error->message);
-                g_object_unref(error);
+                g_error_free(error);
                 return;
         }
 

+ 1 - 0
src/process_pipeline.c

@@ -609,6 +609,7 @@ process_capture_burst(GdkTexture *thumb)
         if (!proc) {
                 g_printerr("Failed to spawn postprocess process: %s\n",
                            error->message);
+                g_error_free(error);
                 return;
         }