<div dir="ltr"><div class="gmail_default" style="font-family:monospace">I think the problem is that when you click Yes on that dialog to add the payee it shouldn't reset the ledgerview at all. It doesn't when you click No, it just clears the payee box. I think that makes sense, but when you click Yes it shouldn't be doing anything to the ledger. Only adding the payee as a payee behind the scenes and leaving the ledger completely alone. So I can continue to add category, cleared status, etc. Thanks for the pointer though, I'll see why it's calling LedgerView::reset in this case when it shouldn't be IMO.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 22, 2023 at 1:58 AM Thomas Baumgart via KMyMoney-devel <<a href="mailto:kmymoney-devel@kde.org">kmymoney-devel@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Samstag, 22. Juli 2023 03:08:26 CEST Jeremy Whiting via KMyMoney-devel wrote:<br>
<br>
> Ok, I think I've hit the edge of my code following for the evening.<br>
> Everything in NewTransactionEditor looks right. It calls<br>
> KMyMoneyUtils::newPayee which works right and finds the index of the new<br>
> payee, etc. The only problem is that after it's done the<br>
> NewTransactionEditor gets destructed for some reason... It gets destructed<br>
> when you click Yes on the Create new payee question dialog. If you click No<br>
> instead it leaves the editor, but clears out the value for the payee as<br>
> expected. I'm not sure why the editor is getting destructed in the<br>
> LedgerView.<br>
<br>
This is caused by LedgerView::reset() which is called when the underlying<br>
engine state (represented by the models) changes. LedgerConcatenateModels<br>
suppresses any signals during the update of the engine objects and simply<br>
calls beginResetModel() and endResetModel() when the objects in the engine<br>
are changed. EndResetModel() calls LedgerView::reset() in the course of<br>
action.<br>
<br>
I added that to reduce the number of sort operations on the ledgers when multiple<br>
(as in many) objects get changed as part of an action (e.g. mark transactions<br>
as cleared). Maybe, this was not the best choice. I know it's more of a<br>
sledge hammer method but works well. It's just not ideal for what we try<br>
to solve here.<br>
<br>
So far, I have no immediate solution to this problem. But I am sure, we will<br>
find one.<br>
<br>
Thomas<br>
<br>
<br>
<br>
> On Fri, Jul 21, 2023 at 5:31 PM Jeremy Whiting <<a href="mailto:jpwhiting@kde.org" target="_blank">jpwhiting@kde.org</a>> wrote:<br>
> <br>
> > Hello,<br>
> ><br>
> > I think there's a recent-ish bug in master. I'm not sure when I started<br>
> > hitting it since I don't often add new payees. But lately when adding a new<br>
> > transaction if you enter a new name for the payee it pops up the dialog "Do<br>
> > you want to add <foo> as a new payee?" which is how it always has been.<br>
> > However lately, clicking yes seems to add the payee to the payees, but also<br>
> > clears out the entered transaction data. It used to just add the payee and<br>
> > let you continue to edit the rest of the transaction details.<br>
> ><br>
> > Clicking No clears everything just like it used to.<br>
> ><br>
> > With a quick dive into the code I *think* it might be a bug around<br>
> > PayeeCreator::createPayee. I think when it calls KMyMoneyUtils::newPayee<br>
> > that works so it drops into the else block, but then somehow doesn't get an<br>
> > index from m_comboBox->findData (maybe because the combobox didn't get<br>
> > notified of the new payee?) so it clears everything out.<br>
> ><br>
> > I'll dive in and see if that's the cause and see if I can find out how to<br>
> > get it added to the combobox maybe, but wanted to point it out in case it's<br>
> > already known and maybe in progress somewhere.<br>
> ><br>
> > thanks,<br>
> > Jeremy<br>
> ><br>
> <br>
<br>
-- <br>
<br>
Regards<br>
<br>
Thomas Baumgart<br>
<br>
-------------------------------------------------------------<br>
Did you hear about the guy who got his whole left side cut off?<br>
He's all right now.<br>
-------------------------------------------------------------<br>
</blockquote></div>