r23477 - gnucash/trunk/src - Bug 708526 - GnuCash Crashes when opening About page
John Ralls
jralls at code.gnucash.org
Mon Dec 2 18:46:41 EST 2013
Author: jralls
Date: 2013-12-02 18:46:40 -0500 (Mon, 02 Dec 2013)
New Revision: 23477
Trac: http://svn.gnucash.org/trac/changeset/23477
Modified:
gnucash/trunk/src/core-utils/gnc-filepath-utils.c
gnucash/trunk/src/gnome-utils/gnc-embedded-window.c
gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Bug 708526 - GnuCash Crashes when opening About page
Downgrade the g_error in gnc_filepath_locate_file() to a g_warning
and ensure that all users will properly handle a NULL return value.
Modified: gnucash/trunk/src/core-utils/gnc-filepath-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-filepath-utils.c 2013-12-02 23:46:31 UTC (rev 23476)
+++ gnucash/trunk/src/core-utils/gnc-filepath-utils.c 2013-12-02 23:46:40 UTC (rev 23477)
@@ -555,7 +555,7 @@
if (!g_file_test (fullname, G_FILE_TEST_IS_REGULAR))
{
- g_error ("Could not locate file %s", name);
+ g_warning ("Could not locate file %s", name);
g_free (fullname);
return NULL;
}
Modified: gnucash/trunk/src/gnome-utils/gnc-embedded-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-embedded-window.c 2013-12-02 23:46:31 UTC (rev 23476)
+++ gnucash/trunk/src/gnome-utils/gnc-embedded-window.c 2013-12-02 23:46:40 UTC (rev 23477)
@@ -366,6 +366,7 @@
/* Determine the full pathname of the ui file */
ui_fullname = gnc_filepath_locate_ui_file (ui_filename);
+ g_return_val_if_fail (ui_fullname != NULL, NULL);
priv->parent_window = enclosing_win;
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2013-12-02 23:46:31 UTC (rev 23476)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2013-12-02 23:46:40 UTC (rev 23477)
@@ -4300,18 +4300,19 @@
get_file (const gchar *partial)
{
gchar *filename, *text = NULL;
+ gsize length;
filename = gnc_filepath_locate_doc_file(partial);
- g_file_get_contents(filename, &text, NULL, NULL);
- g_free(filename);
-
- /* Anything there? */
- if (text && *text)
- return text;
-
- /* Just a empty string or no string at all. */
- if (text)
+ if (filename && g_file_get_contents(filename, &text, &length, NULL))
+ {
+ if (length)
+ {
+ g_free(filename);
+ return text;
+ }
g_free(text);
+ }
+ g_free (filename);
return NULL;
}
More information about the gnucash-changes
mailing list