r23706 - gnucash/trunk/src/register/ledger-core - Bug 721791 - Segmentation fault when correcting invalid date

John Ralls jralls at code.gnucash.org
Sat Jan 18 16:50:22 EST 2014


Author: jralls
Date: 2014-01-18 16:50:21 -0500 (Sat, 18 Jan 2014)
New Revision: 23706
Trac: http://svn.gnucash.org/trac/changeset/23706

Modified:
   gnucash/trunk/src/register/ledger-core/split-register-model.c
Log:
Bug 721791 - Segmentation fault when correcting invalid date

And greatly simplify gnc_split_register_get_date_help by just getting a GDate and running
g_date_strftime on it instead of messing around with Timespecs and g_localtime_r (twice!)
and all of that just to make a stupid string.

Modified: gnucash/trunk/src/register/ledger-core/split-register-model.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-model.c	2014-01-18 18:47:52 UTC (rev 23705)
+++ gnucash/trunk/src/register/ledger-core/split-register-model.c	2014-01-18 21:50:21 UTC (rev 23706)
@@ -906,21 +906,17 @@
     SplitRegister *reg = user_data;
     BasicCell *cell;
     char string[1024];
-    struct tm tm;
-    Timespec ts;
-    time64 tt;
+    GDate date;
 
     cell = gnc_table_get_cell (reg->table, virt_loc);
     if (!cell || !cell->value || *cell->value == '\0')
         return NULL;
 
-    gnc_date_cell_get_date ((DateCell *) cell, &ts);
-    tt = ts.tv_sec;
+    g_date_clear (&date, 1);
+    gnc_date_cell_get_date_gdate ((DateCell *) cell, &date);
 
-    gnc_localtime_r (&tt, &tm);
+    g_date_strftime (string, sizeof (string), _("%A %d %B %Y"), &date);
 
-    qof_strftime (string, sizeof (string), _("%A %d %B %Y"), &tm);
-
     return g_strdup (string);
 }
 



More information about the gnucash-changes mailing list