mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fixed kvp-value delete
Delete wasn't being called properly due to bad template resolution.
This commit is contained in:
parent
8eae1d8f44
commit
6c2a42bf49
@ -291,33 +291,35 @@ compare(const KvpValueImpl * one, const KvpValueImpl * two) noexcept
|
||||
return compare(*one, *two);
|
||||
}
|
||||
|
||||
template <typename T> void
|
||||
delete_value(T & value)
|
||||
struct delete_visitor : boost::static_visitor<void>
|
||||
{
|
||||
/*do nothing*/
|
||||
}
|
||||
template <typename T> void
|
||||
operator()(T &) { /*do nothing*/ }
|
||||
};
|
||||
|
||||
template <> void
|
||||
delete_value(GList * & value)
|
||||
delete_visitor::operator()(GList * & value)
|
||||
{
|
||||
kvp_glist_delete(value);
|
||||
}
|
||||
template <> void
|
||||
delete_value(gchar * & value)
|
||||
delete_visitor::operator()(gchar * & value)
|
||||
{
|
||||
g_free(value);
|
||||
}
|
||||
template <> void
|
||||
delete_value(GncGUID * & value)
|
||||
delete_visitor::operator()(GncGUID * & value)
|
||||
{
|
||||
guid_free(value);
|
||||
}
|
||||
template <> void
|
||||
delete_value(KvpFrame * & value)
|
||||
delete_visitor::operator()(KvpFrame * & value)
|
||||
{
|
||||
kvp_frame_delete(value);
|
||||
}
|
||||
|
||||
KvpValueImpl::~KvpValueImpl() noexcept
|
||||
{
|
||||
delete_value(datastore);
|
||||
delete_visitor d;
|
||||
boost::apply_visitor(d, datastore);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user