From d5d7e88ebe15364f9089b17a1e287872c807b28c Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Jun 04 2016 22:14:54 +0000 Subject: add crasher fix --- diff --git a/f679bf70e8293021c4d42bdd331d0184d0ed140e.patch b/f679bf70e8293021c4d42bdd331d0184d0ed140e.patch new file mode 100644 index 0000000..8fcb21c --- /dev/null +++ b/f679bf70e8293021c4d42bdd331d0184d0ed140e.patch @@ -0,0 +1,59 @@ +commit f679bf70e8293021c4d42bdd331d0184d0ed140e +Author: John Ralls +Date: Tue May 10 13:28:58 2016 -0700 + + Bug 766028 - crash on manual addition of price entry in Price Editor + + gnc_pricedb_remove_price invalidates db->commodity_hash so removing the + old price needs to be done before it's retrieved. + +diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c +index 790cf32..f777f5f 100644 +--- a/src/engine/gnc-pricedb.c ++++ b/src/engine/gnc-pricedb.c +@@ -1047,6 +1047,22 @@ add_price(GNCPriceDB *db, GNCPrice *p) + LEAVE ("no commodity hash found "); + return FALSE; + } ++/* Check for an existing price on the same day. If there is no existing price, ++ * add this one. If this price is of equal or better precedence than the old ++ * one, copy this one over the old one. ++ */ ++ old_price = gnc_pricedb_lookup_day (db, p->commodity, p->currency, ++ p->tmspec); ++ if (!db->bulk_update && old_price != NULL) ++ { ++ if (p->source > old_price->source) ++ { ++ gnc_price_unref(p); ++ LEAVE ("Better price already in DB."); ++ return FALSE; ++ } ++ gnc_pricedb_remove_price(db, old_price); ++ } + + currency_hash = g_hash_table_lookup(db->commodity_hash, commodity); + if (!currency_hash) +@@ -1068,22 +1084,6 @@ add_price(GNCPriceDB *db, GNCPrice *p) + return FALSE; + } + +-/* Check for an existing price on the same day. If there is no existing price, +- * add this one. If this price is of equal or better precedence than the old +- * one, copy this one over the old one. +- */ +- old_price = gnc_pricedb_lookup_day (db, p->commodity, p->currency, +- p->tmspec); +- if (!db->bulk_update && old_price != NULL) +- { +- if (p->source > old_price->source) +- { +- gnc_price_unref(p); +- LEAVE ("Better price already in DB."); +- return FALSE; +- } +- gnc_pricedb_remove_price(db, old_price); +- } + g_hash_table_insert(currency_hash, currency, price_list); + p->db = db; + diff --git a/gnucash.spec b/gnucash.spec index 5e3ebee..ed96284 100644 --- a/gnucash.spec +++ b/gnucash.spec @@ -27,6 +27,8 @@ Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig Obsoletes: gnucash-backend-postgres +Patch0: f679bf70e8293021c4d42bdd331d0184d0ed140e.patch + %description GnuCash is a personal finance manager. A check-book like register GUI allows you to enter and track bank accounts, stocks, income and even @@ -36,6 +38,7 @@ balanced books. %prep %setup -q +%patch0 -p1 find src/quotes -name "*.in" -exec sed -i "s|use lib '@-PERLINCL-@';||g" {} \; %build @@ -133,6 +136,9 @@ fi %config(noreplace) %{_sysconfdir}/gnucash/* %changelog +* Sat Jun 4 2016 Bill Nottingham - 2.6.12-2 +- add upstream fix for price editor crash (#1334089, #1337078, #1342719) + * Tue Apr 19 2016 Bill Nottingham - 2.6.12-1 - update to 2.6.12 (#1321562)