mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 794936 - 3.0 does not open previously saved sqlite3 files...
properly - corrupted business data Turned out to be a pointer/value mismatch between <CT_NUMERIC>load() and most of the setter functions, so the address was getting set as the value.
This commit is contained in:
@@ -95,7 +95,7 @@ static void set_timespec_val (gpointer pObject, Timespec *ts);
|
|||||||
static gpointer get_guid_val (gpointer pObject);
|
static gpointer get_guid_val (gpointer pObject);
|
||||||
static void set_guid_val (gpointer pObject, gpointer pValue);
|
static void set_guid_val (gpointer pObject, gpointer pValue);
|
||||||
static gnc_numeric get_numeric_val (gpointer pObject);
|
static gnc_numeric get_numeric_val (gpointer pObject);
|
||||||
static void set_numeric_val (gpointer pObject, gnc_numeric *value);
|
static void set_numeric_val (gpointer pObject, gnc_numeric value);
|
||||||
static GDate* get_gdate_val (gpointer pObject);
|
static GDate* get_gdate_val (gpointer pObject);
|
||||||
static void set_gdate_val (gpointer pObject, GDate* value);
|
static void set_gdate_val (gpointer pObject, GDate* value);
|
||||||
static slot_info_t* slot_info_copy (slot_info_t* pInfo, GncGUID* guid);
|
static slot_info_t* slot_info_copy (slot_info_t* pInfo, GncGUID* guid);
|
||||||
@@ -515,7 +515,7 @@ get_numeric_val (gpointer pObject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_numeric_val (gpointer pObject, gnc_numeric *value)
|
set_numeric_val (gpointer pObject, gnc_numeric value)
|
||||||
{
|
{
|
||||||
slot_info_t* pInfo = (slot_info_t*)pObject;
|
slot_info_t* pInfo = (slot_info_t*)pObject;
|
||||||
KvpValue* pValue = NULL;
|
KvpValue* pValue = NULL;
|
||||||
@@ -523,7 +523,7 @@ set_numeric_val (gpointer pObject, gnc_numeric *value)
|
|||||||
g_return_if_fail (pObject != NULL);
|
g_return_if_fail (pObject != NULL);
|
||||||
|
|
||||||
if (pInfo->value_type != KvpValue::Type::NUMERIC) return;
|
if (pInfo->value_type != KvpValue::Type::NUMERIC) return;
|
||||||
set_slot_from_value (pInfo, new KvpValue {*value});
|
set_slot_from_value (pInfo, new KvpValue {value});
|
||||||
}
|
}
|
||||||
|
|
||||||
static GDate*
|
static GDate*
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ GncSqlColumnTableEntryImpl<CT_GDATE>::add_to_query(QofIdTypeConst obj_name,
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
typedef gnc_numeric (*NumericGetterFunc) (const gpointer);
|
typedef gnc_numeric (*NumericGetterFunc) (const gpointer);
|
||||||
typedef void (*NumericSetterFunc) (gpointer, gnc_numeric*);
|
typedef void (*NumericSetterFunc) (gpointer, gnc_numeric);
|
||||||
|
|
||||||
static const EntryVec numeric_col_table =
|
static const EntryVec numeric_col_table =
|
||||||
{
|
{
|
||||||
@@ -601,6 +601,16 @@ static const EntryVec numeric_col_table =
|
|||||||
gnc_sql_make_table_entry<CT_INT64>("denom", 0, COL_NNUL, "guid")
|
gnc_sql_make_table_entry<CT_INT64>("denom", 0, COL_NNUL, "guid")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void set_parameter<gpointer, gnc_numeric>(gpointer object,
|
||||||
|
gnc_numeric item,
|
||||||
|
const char* property)
|
||||||
|
{
|
||||||
|
qof_instance_increase_editlevel(object);
|
||||||
|
g_object_set(object, property, &item, nullptr);
|
||||||
|
qof_instance_decrease_editlevel(object);
|
||||||
|
};
|
||||||
|
|
||||||
template<> void
|
template<> void
|
||||||
GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
||||||
GncSqlRow& row,
|
GncSqlRow& row,
|
||||||
@@ -626,7 +636,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_parameter(pObject, &n,
|
set_parameter(pObject, n,
|
||||||
reinterpret_cast<NumericSetterFunc>(get_setter(obj_name)),
|
reinterpret_cast<NumericSetterFunc>(get_setter(obj_name)),
|
||||||
m_gobj_param_name);
|
m_gobj_param_name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user