gnucash maint: Bug 745265 - Segfault in generate_statusbar_lastmodified_message on Windows

John Ralls jralls at code.gnucash.org
Wed Mar 11 04:02:20 EDT 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/b870718f (commit)
	from  https://github.com/Gnucash/gnucash/commit/8d188bcb (commit)



commit b870718fa3ecac65355b0f0e761fb80bceb648e3
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Mar 11 16:51:38 2015 +0900

    Bug 745265 - Segfault in generate_statusbar_lastmodified_message on Windows
    
    Check for g_date_time_format returning NULL (as it's supposed to do) as
    well as an empty string to avoid dereferencing the empty string. That
    fixes the crash, but not all locales work with %a, %b %e, %Y at %H:%M so
    that might return NULL too, so make the default string %x %X which will
    return something useful regardless. This is a translated string so
    translators can do something nicer for their locales if they like.
    
    Since the bug's reporter was Japanese and the string around which the
    bug revolves wasn't translated in Japanese I got a translation from him
    and updated it.

diff --git a/po/ja.po b/po/ja.po
index d772c5a..459c762 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -10741,11 +10741,11 @@ msgstr "未保存の帳簿"
 
 #: ../../gnucash/po/../src/gnome-utils/gnc-main-window.c:1669
 msgid "Last modified on %a, %b %e, %Y at %I:%M%P"
-msgstr ""
+msgstr "最終更新: %x %X"
 
 #: ../../gnucash/po/../src/gnome-utils/gnc-main-window.c:1670
 msgid "Last modified on %a, %b %e, %Y at %H:%M"
-msgstr ""
+msgstr "最終更新: %x %X"
 
 #. g_warning("got time %ld, str=%s\n", mtime, time_string);
 #. Translators: This message appears in the status bar after opening the file.
diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c
index 0635cf7..b301b90 100644
--- a/src/gnome-utils/gnc-main-window.c
+++ b/src/gnome-utils/gnc-main-window.c
@@ -1665,7 +1665,8 @@ static gchar *generate_statusbar_lastmodified_message()
                     that has the a.m. or p.m. string in its locale, second
                     string is for locales that do not have that string. */
                     gchar *time_string =
-                        g_date_time_format (gdt, (strlen(dummy_strftime_has_ampm) > 0)
+                        g_date_time_format (gdt, (dummy_strftime_has_ampm &&
+						  strlen(dummy_strftime_has_ampm) > 0)
                                             ? _("Last modified on %a, %b %e, %Y at %I:%M%P")
                                             : _("Last modified on %a, %b %e, %Y at %H:%M"));
 



Summary of changes:
 po/ja.po                          | 4 ++--
 src/gnome-utils/gnc-main-window.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list