gnucash maint: Bug 798535 - Crash when increasing the number of periods in a budget
Christopher Lam
clam at code.gnucash.org
Wed May 18 05:38:16 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/670902d5 (commit)
from https://github.com/Gnucash/gnucash/commit/29f2c7c3 (commit)
commit 670902d5a86fd1686051370c84731ee50d1da13f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed May 18 17:37:05 2022 +0800
Bug 798535 - Crash when increasing the number of periods in a budget
because in the SQL backend, gnc_budget_commit_edit will update the sql
by reading from vectors with an increased priv->num_periods.
diff --git a/libgnucash/engine/gnc-budget.cpp b/libgnucash/engine/gnc-budget.cpp
index 02beeff82..3600b3910 100644
--- a/libgnucash/engine/gnc-budget.cpp
+++ b/libgnucash/engine/gnc-budget.cpp
@@ -476,15 +476,14 @@ gnc_budget_set_num_periods(GncBudget* budget, guint num_periods)
gnc_budget_begin_edit(budget);
priv->num_periods = num_periods;
- qof_instance_set_dirty(&budget->inst);
- gnc_budget_commit_edit(budget);
-
std::for_each (priv->acct_map->begin(),
priv->acct_map->end(),
[num_periods](auto& it)
{
it.second.resize(num_periods);
});
+ qof_instance_set_dirty(&budget->inst);
+ gnc_budget_commit_edit(budget);
qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
}
Summary of changes:
libgnucash/engine/gnc-budget.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
More information about the gnucash-changes
mailing list