[evolution/gnome-3-22] Consume return value of gtk_clutter_init_with_args()/gtk_init_with_args()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-22] Consume return value of gtk_clutter_init_with_args()/gtk_init_with_args()
- Date: Tue, 18 Oct 2016 17:54:32 +0000 (UTC)
commit a40c4ae3087a745a3f4dcc77e3c437daf6d6ddb7
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 18 19:47:53 2016 +0200
Consume return value of gtk_clutter_init_with_args()/gtk_init_with_args()
The former claim a compile-time warning, but sets the 'error' on failure,
the later doesn't claim a compile-time warning, but does not set the 'error'
on failure. Using the return value of both functions fixes two things at once.
shell/main.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/shell/main.c b/shell/main.c
index f472b2c..0ece81d 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -435,6 +435,7 @@ main (gint argc,
#ifdef DEVELOPMENT
gboolean skip_warning_dialog;
#endif
+ gboolean success;
GError *error = NULL;
#ifdef G_OS_WIN32
@@ -460,24 +461,20 @@ main (gint argc,
/* The contact maps feature uses clutter-gtk. */
#ifdef WITH_CONTACT_MAPS
- /* XXX This function is declared in gtk-clutter-util.h with an
- * unnecessary G_GNUC_WARN_UNUSED_RESULT attribute. But we
- * don't need the returned error code because we're checking
- * the GError directly. Just ignore this warning. */
- gtk_clutter_init_with_args (
+ success = gtk_clutter_init_with_args (
&argc, &argv,
_("- The Evolution PIM and Email Client"),
- entries, (gchar *) GETTEXT_PACKAGE, &error);
+ entries, (gchar *) GETTEXT_PACKAGE, &error) == CLUTTER_INIT_SUCCESS;
#else
- gtk_init_with_args (
+ success = gtk_init_with_args (
&argc, &argv,
_("- The Evolution PIM and Email Client"),
entries, (gchar *) GETTEXT_PACKAGE, &error);
#endif /* WITH_CONTACT_MAPS */
- if (error != NULL) {
- g_printerr ("%s\n", error->message);
- g_error_free (error);
+ if (!success || error) {
+ g_printerr ("Failed to initialize gtk+: %s\n", error ? error->message : "Unknown error");
+ g_clear_error (&error);
exit (1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]