mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix a crash when manipulating commodities before crating the first
account. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13081 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
fa0b6374c3
commit
88aff74d31
@ -48,6 +48,7 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GtkWidget * dialog;
|
GtkWidget * dialog;
|
||||||
|
QofBook *book;
|
||||||
|
|
||||||
GncTreeViewCommodity * commodity_tree;
|
GncTreeViewCommodity * commodity_tree;
|
||||||
GtkWidget * edit_button;
|
GtkWidget * edit_button;
|
||||||
@ -88,7 +89,6 @@ edit_clicked (CommoditiesDialog *cd)
|
|||||||
static void
|
static void
|
||||||
remove_clicked (CommoditiesDialog *cd)
|
remove_clicked (CommoditiesDialog *cd)
|
||||||
{
|
{
|
||||||
QofBook *book;
|
|
||||||
GNCPriceDB *pdb;
|
GNCPriceDB *pdb;
|
||||||
GList *node;
|
GList *node;
|
||||||
GList *prices;
|
GList *prices;
|
||||||
@ -131,9 +131,9 @@ remove_clicked (CommoditiesDialog *cd)
|
|||||||
g_list_free (accounts);
|
g_list_free (accounts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
g_list_free (accounts);
|
||||||
|
|
||||||
book = xaccGroupGetBook (xaccAccountGetRoot (accounts->data));
|
pdb = gnc_pricedb_get_db (cd->book);
|
||||||
pdb = gnc_pricedb_get_db (book);
|
|
||||||
prices = gnc_pricedb_get_prices(pdb, commodity, NULL);
|
prices = gnc_pricedb_get_prices(pdb, commodity, NULL);
|
||||||
if (prices)
|
if (prices)
|
||||||
{
|
{
|
||||||
@ -175,7 +175,6 @@ remove_clicked (CommoditiesDialog *cd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gnc_price_list_destroy(prices);
|
gnc_price_list_destroy(prices);
|
||||||
g_list_free (accounts);
|
|
||||||
gnc_gui_refresh_all ();
|
gnc_gui_refresh_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,6 +287,7 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
|
|||||||
dialog = glade_xml_get_widget (xml, "Commodities Dialog");
|
dialog = glade_xml_get_widget (xml, "Commodities Dialog");
|
||||||
|
|
||||||
cd->dialog = dialog;
|
cd->dialog = dialog;
|
||||||
|
cd->book = gnc_get_current_book();
|
||||||
cd->show_currencies = gnc_gconf_get_bool(GCONF_SECTION, "include_iso", NULL);
|
cd->show_currencies = gnc_gconf_get_bool(GCONF_SECTION, "include_iso", NULL);
|
||||||
|
|
||||||
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, cd);
|
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, cd);
|
||||||
@ -303,7 +303,7 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
|
|||||||
/* commodity tree */
|
/* commodity tree */
|
||||||
|
|
||||||
scrolled_window = glade_xml_get_widget (xml, "commodity_list_window");
|
scrolled_window = glade_xml_get_widget (xml, "commodity_list_window");
|
||||||
view = gnc_tree_view_commodity_new(gnc_get_current_book (),
|
view = gnc_tree_view_commodity_new(cd->book,
|
||||||
"gconf-section", GCONF_SECTION,
|
"gconf-section", GCONF_SECTION,
|
||||||
"show-column-menu", TRUE,
|
"show-column-menu", TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user