Merge branch 'gerror' into 'master'
Avoid g_error_free See merge request postmarketOS/megapixels!4
This commit is contained in:
commit
fd64a9312c
14
src/flash.c
14
src/flash.c
|
@ -55,12 +55,11 @@ static int dbus_old_brightness = 0;
|
|||
static void
|
||||
dbus_brightness_init(GObject *src, GAsyncResult *res, gpointer *user_data)
|
||||
{
|
||||
GError *err = NULL;
|
||||
g_autoptr(GError) err = NULL;
|
||||
dbus_brightness_proxy = g_dbus_proxy_new_finish(res, &err);
|
||||
if (!dbus_brightness_proxy || err) {
|
||||
printf("Failed to connect to dbus brightness service %s\n",
|
||||
err->message);
|
||||
g_error_free(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -140,24 +139,21 @@ set_display_brightness(int brightness)
|
|||
static void
|
||||
brightness_received(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GVariant *result = g_dbus_proxy_call_finish(proxy, res, &error);
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GVariant) result = g_dbus_proxy_call_finish(proxy, res, &error);
|
||||
|
||||
if (!result) {
|
||||
printf("Failed to get display brightness: %s\n", error->message);
|
||||
g_error_free(error);
|
||||
return;
|
||||
}
|
||||
|
||||
GVariant *values = g_variant_get_child_value(result, 0);
|
||||
g_autoptr(GVariant) values = g_variant_get_child_value(result, 0);
|
||||
if (g_variant_n_children(values) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
GVariant *brightness = g_variant_get_child_value(values, 0);
|
||||
g_autoptr(GVariant) brightness = g_variant_get_child_value(values, 0);
|
||||
dbus_old_brightness = g_variant_get_int32(brightness);
|
||||
|
||||
g_variant_unref(result);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
12
src/main.c
12
src/main.c
|
@ -490,7 +490,7 @@ void
|
|||
run_open_last_action(GSimpleAction *action, GVariant *param, gpointer user_data)
|
||||
{
|
||||
char uri[275];
|
||||
GError *error = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (strlen(last_path) == 0) {
|
||||
return;
|
||||
|
@ -500,7 +500,6 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,11 +507,10 @@ void
|
|||
run_open_photos_action(GSimpleAction *action, GVariant *param, gpointer user_data)
|
||||
{
|
||||
char uri[270];
|
||||
GError *error = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,13 +571,12 @@ check_point_inside_bounds(int x, int y, int *bounds_x, int *bounds_y)
|
|||
static void
|
||||
on_zbar_dialog_response(GtkDialog *dialog, int response, char *data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
switch (response) {
|
||||
case GTK_RESPONSE_YES:
|
||||
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));
|
||||
|
@ -925,12 +922,11 @@ update_ui_rotation()
|
|||
static void
|
||||
display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
GVariant *result = g_dbus_connection_call_finish(conn, res, &error);
|
||||
|
||||
if (!result) {
|
||||
printf("Failed to get display configuration: %s\n", error->message);
|
||||
g_error_free(error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ process_capture_burst(GdkTexture *thumb)
|
|||
burst_dir,
|
||||
capture_fname,
|
||||
save_dng_s);
|
||||
GError *error = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
GSubprocess *proc = g_subprocess_new(G_SUBPROCESS_FLAGS_STDOUT_PIPE,
|
||||
&error,
|
||||
processing_script,
|
||||
|
@ -609,7 +609,6 @@ process_capture_burst(GdkTexture *thumb)
|
|||
if (!proc) {
|
||||
g_printerr("Failed to spawn postprocess process: %s\n",
|
||||
error->message);
|
||||
g_error_free(error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue