mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
When destroying a commodity, remove it from the commodity table.
Fixes random crashes demonstrated by test-xml-commodities. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13737 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
69daf241c8
commit
0609d99045
@ -544,8 +544,14 @@ gnc_commodity_new(QofBook *book, const char * fullname,
|
|||||||
void
|
void
|
||||||
gnc_commodity_destroy(gnc_commodity * cm)
|
gnc_commodity_destroy(gnc_commodity * cm)
|
||||||
{
|
{
|
||||||
|
QofBook *book;
|
||||||
|
gnc_commodity_table *table;
|
||||||
if(!cm) return;
|
if(!cm) return;
|
||||||
|
|
||||||
|
book = qof_instance_get_book(&cm->inst);
|
||||||
|
table = gnc_commodity_table_get_table(book);
|
||||||
|
gnc_commodity_table_remove(table, cm);
|
||||||
|
|
||||||
qof_event_gen (&cm->inst.entity, QOF_EVENT_DESTROY, NULL);
|
qof_event_gen (&cm->inst.entity, QOF_EVENT_DESTROY, NULL);
|
||||||
|
|
||||||
/* Set at creation */
|
/* Set at creation */
|
||||||
|
Loading…
Reference in New Issue
Block a user