diff options
author | Monsta <[email protected]> | 2015-01-28 14:06:17 +0300 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2015-03-15 22:42:01 +0100 |
commit | aa4ce70d4b94598b0fda38b587bacc754cc656b7 (patch) | |
tree | 9231295496201a78c167ec5260a27dbcce29c51b | |
parent | 44c02a163351beb2f48dae480954913615f903fd (diff) | |
download | mate-power-manager-aa4ce70d4b94598b0fda38b587bacc754cc656b7.tar.bz2 mate-power-manager-aa4ce70d4b94598b0fda38b587bacc754cc656b7.tar.xz |
abort application when UI load fails
some genius who programmed this decided it would be fine to access
GtkBuilder variables after gtk_builder_add_from_file fails. thanks
for the segfault, man. I've wasted an hour trying to find out what
happens.
Closes https://github.com/mate-desktop/mate-power-manager/pull/128
-rw-r--r-- | src/gpm-prefs-core.c | 7 | ||||
-rw-r--r-- | src/gpm-statistics.c | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index c83fe02..0d3bdce 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -884,13 +884,12 @@ gpm_prefs_init (GpmPrefs *prefs) } g_ptr_array_unref (devices); + error = NULL; prefs->priv->builder = gtk_builder_new (); - retval = gtk_builder_add_from_file (prefs->priv->builder, GPM_DATA "/gpm-prefs.ui", &error); - if (retval == 0) { - egg_warning ("failed to load ui: %s", error->message); - g_error_free (error); + if (error) { + egg_error ("failed to load ui: %s", error->message); } main_window = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "dialog_preferences")); diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index 795a372..423d4e1 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -1575,12 +1575,10 @@ main (int argc, char *argv[]) /* get UI */ builder = gtk_builder_new (); - retval = gtk_builder_add_from_file (builder, GPM_DATA "/gpm-statistics.ui", &error); - if (retval == 0) { - egg_warning ("failed to load ui: %s", error->message); - g_error_free (error); + if (error) { + egg_error ("failed to load ui: %s", error->message); } /* add history graph */ |