Commit 8a287fc4 authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by Gerrit Code Review

gnome: use g_clear_error to free GError

This sets the GError to NULL after freeing it
which is useful in cases where the GError might
be re-used.

Refs #72309

Change-Id: If3c33235378bc080b497bed732570f17e8e6d3e9
parent 101f310c
......@@ -43,7 +43,7 @@ client_cb(G_GNUC_UNUSED ESource *source, GAsyncResult *result, G_GNUC_UNUSED gpo
EClient *client = e_book_client_connect_finish(result, &error);
if (!client) {
g_warning("%s", error->message);
g_error_free(error);
g_clear_error(&error);
} else {
/* got a client for this addressbook, add as backend */
PersonModel::instance()->addCollection<EdsContactBackend, EClient *>(
......@@ -58,7 +58,7 @@ registry_cb(G_GNUC_UNUSED GObject *source, GAsyncResult *result, GCancellable *c
ESourceRegistry *registry = e_source_registry_new_finish(result, &error);
if(!registry) {
g_critical("Unable to create EDS registry: %s", error->message);
g_error_free(error);
g_clear_error(&error);
return;
} else {
GList *list = e_source_registry_list_enabled(registry, E_SOURCE_EXTENSION_ADDRESS_BOOK);
......@@ -190,7 +190,7 @@ contacts_cb(EBookClient *client, GAsyncResult *result, EdsContactBackend *self)
GError *error = NULL;
if(!e_book_client_get_contacts_finish(client, result, &contacts, &error)) {
g_critical("Unable to get contacts: %s", error->message);
g_error_free(error);
g_clear_error(&error);
return;
} else {
self->addContacts(contacts);
......@@ -209,7 +209,7 @@ void EdsContactBackend::parseContact(EContact *contact)
GError *error = NULL;
if (!e_contact_inline_local_photos(contact, &error)) {
g_warning("could not inline photo from vcard URI: %s", error->message);
g_error_free(error);
g_clear_error(&error);
}
}
}
......
......@@ -137,8 +137,7 @@ QVariant PixbufDelegate::personPhoto(const QByteArray& data, const QString& type
if (!pixbuf) {
// g_debug("failed decoding person photo using base64: %s", error->message);
g_error_free(error);
error = NULL;
g_clear_error(&error);
/* failed with base64, try hex */
QByteArray baHex = QByteArray::fromHex(data);
......@@ -152,8 +151,7 @@ QVariant PixbufDelegate::personPhoto(const QByteArray& data, const QString& type
if (!pixbuf) {
// g_debug("failed decoding person photo using hex (ASCII): %s", error->message);
g_error_free(error);
error = NULL;
g_clear_error(&error);
}
}
......
......@@ -86,7 +86,7 @@ ring_about_dialog(GtkWidget *parent)
GdkPixbuf* logo = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-logo-blue", &error);
if (logo == NULL) {
g_debug("Could not load logo: %s", error->message);
g_error_free(error);
g_clear_error(&error);
}
gchar *name = g_strdup_printf("Gnome Ring v%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
......
......@@ -279,7 +279,7 @@ ring_client_command_line(GApplication *app, GApplicationCommandLine *cmdline)
if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) {
g_print(_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
error->message, argv[0]);
g_error_free(error);
g_clear_error(&error);
g_option_context_free(context);
return 1;
}
......
......@@ -600,7 +600,7 @@ show_account_creation(RingMainWindow *win)
-1, 75, TRUE, &error);
if (logo_ring == NULL) {
g_debug("Could not load logo: %s", error->message);
g_error_free(error);
g_clear_error(&error);
} else
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_ring_logo), logo_ring);
......@@ -894,7 +894,7 @@ ring_main_window_init(RingMainWindow *win)
GdkPixbuf* icon = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-symbol-blue", &error);
if (icon == NULL) {
g_debug("Could not load icon: %s", error->message);
g_error_free(error);
g_clear_error(&error);
} else
gtk_window_set_icon(GTK_WINDOW(win), icon);
......@@ -903,7 +903,7 @@ ring_main_window_init(RingMainWindow *win)
-1, 24, TRUE, &error);
if (image_ring == NULL) {
g_debug("Could not load icon: %s", error->message);
g_error_free(error);
g_clear_error(&error);
} else
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_ring), image_ring);
......
......@@ -460,7 +460,7 @@ clutter_render_image(VideoWidgetRenderer* wg_renderer)
&error);
if (error) {
g_warning("error rendering image to clutter: %s", error->message);
g_error_free(error);
g_clear_error(&error);
g_object_unref (image_new);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment