r22495 - gnucash/branches/2.4/src/engine - [r22465]Allow SchedXaction to safely handle having g_object_property_set

John Ralls jralls at code.gnucash.org
Thu Nov 1 17:28:02 EDT 2012


Author: jralls
Date: 2012-11-01 17:28:02 -0400 (Thu, 01 Nov 2012)
New Revision: 22495
Trac: http://svn.gnucash.org/trac/changeset/22495

Modified:
   gnucash/branches/2.4/src/engine/SchedXaction.c
Log:
[r22465]Allow SchedXaction to safely handle having g_object_property_set
called on end_date and last_date with invalid GDates.

This happens routinely when those values are empty and are restored from
SQL. Thanks to all warnings being fatal when testing, this caused the dbi
tests to fail.

Modified: gnucash/branches/2.4/src/engine/SchedXaction.c
===================================================================
--- gnucash/branches/2.4/src/engine/SchedXaction.c	2012-11-01 21:19:30 UTC (rev 22494)
+++ gnucash/branches/2.4/src/engine/SchedXaction.c	2012-11-01 21:28:02 UTC (rev 22495)
@@ -136,10 +136,16 @@
         g_value_set_boxed(value, &sx->start_date);
         break;
     case PROP_END_DATE:
-        g_value_set_boxed(value, &sx->end_date);
+        /* g_value_set_boxed raises a critical error if sx->end_date
+         * is invalid */
+        if (g_date_valid (&sx->end_date))
+            g_value_set_boxed(value, &sx->end_date);
         break;
     case PROP_LAST_OCCURANCE_DATE:
-        g_value_set_boxed(value, &sx->last_date);
+     /* g_value_set_boxed raises a critical error if sx->last_date
+         * is invalid */
+        if (g_date_valid (&sx->last_date))
+            g_value_set_boxed(value, &sx->last_date);
         break;
     case PROP_INSTANCE_COUNT:
         g_value_set_int(value, sx->instance_num);



More information about the gnucash-changes mailing list