gnucash maint: Bug 797895 - Hang for a long time (9 minutes per account) importing...
John Ralls
jralls at code.gnucash.org
Thu Sep 17 17:27:05 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/9c8fa5cd (commit)
from https://github.com/Gnucash/gnucash/commit/1a50a29d (commit)
commit 9c8fa5cd2e28af1ab133375bf06be5637820d265
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Sep 17 14:22:07 2020 -0700
Bug 797895 - Hang for a long time (9 minutes per account) importing...
a QFX file.
Bug 797945 - Tools -> Import Map Editor causes GnuCash to lock up.
Don't edit and commit the account if it has no BAYES_IMAP slots. Account
committing is extremely expensive.
diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index 6c574cf02..10f8b3cac 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -5540,7 +5540,7 @@ convert_entry (KvpEntry entry, Account* root)
}
static std::vector<FlatKvpEntry>
-get_new_flat_imap (Account * acc)
+get_flat_imap (Account * acc)
{
auto frame = qof_instance_get_slots (QOF_INSTANCE (acc));
auto slot = frame->get_slot ({IMAP_FRAME_BAYES});
@@ -5566,17 +5566,15 @@ convert_imap_account_bayes_to_flat (Account *acc)
auto frame = qof_instance_get_slots (QOF_INSTANCE (acc));
if (!frame->get_keys().size())
return false;
- auto new_imap = get_new_flat_imap(acc);
+ auto flat_imap = get_flat_imap(acc);
+ if (!flat_imap.size ())
+ return false;
xaccAccountBeginEdit(acc);
frame->set({IMAP_FRAME_BAYES}, nullptr);
- if (!new_imap.size ())
- {
- xaccAccountCommitEdit(acc);
- return false;
- }
- std::for_each(new_imap.begin(), new_imap.end(), [&frame] (FlatKvpEntry const & entry) {
- frame->set({entry.first.c_str()}, entry.second);
- });
+ std::for_each(flat_imap.begin(), flat_imap.end(),
+ [&frame] (FlatKvpEntry const & entry) {
+ frame->set({entry.first.c_str()}, entry.second);
+ });
qof_instance_set_dirty (QOF_INSTANCE (acc));
xaccAccountCommitEdit(acc);
return true;
Summary of changes:
libgnucash/engine/Account.cpp | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
More information about the gnucash-changes
mailing list