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:
parent
3138229cf6
commit
39aecb7610
@ -95,7 +95,7 @@ static void set_timespec_val (gpointer pObject, Timespec *ts);
|
||||
static gpointer get_guid_val (gpointer pObject);
|
||||
static void set_guid_val (gpointer pObject, gpointer pValue);
|
||||
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 void set_gdate_val (gpointer pObject, GDate* value);
|
||||
static slot_info_t* slot_info_copy (slot_info_t* pInfo, GncGUID* guid);
|
||||
@ -515,7 +515,7 @@ get_numeric_val (gpointer pObject)
|
||||
}
|
||||
|
||||
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;
|
||||
KvpValue* pValue = NULL;
|
||||
@ -523,7 +523,7 @@ set_numeric_val (gpointer pObject, gnc_numeric *value)
|
||||
g_return_if_fail (pObject != NULL);
|
||||
|
||||
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*
|
||||
|
@ -593,7 +593,7 @@ GncSqlColumnTableEntryImpl<CT_GDATE>::add_to_query(QofIdTypeConst obj_name,
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
typedef gnc_numeric (*NumericGetterFunc) (const gpointer);
|
||||
typedef void (*NumericSetterFunc) (gpointer, gnc_numeric*);
|
||||
typedef void (*NumericSetterFunc) (gpointer, gnc_numeric);
|
||||
|
||||
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")
|
||||
};
|
||||
|
||||
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
|
||||
GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
||||
GncSqlRow& row,
|
||||
@ -626,7 +636,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
||||
{
|
||||
return;
|
||||
}
|
||||
set_parameter(pObject, &n,
|
||||
set_parameter(pObject, n,
|
||||
reinterpret_cast<NumericSetterFunc>(get_setter(obj_name)),
|
||||
m_gobj_param_name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user