crash in new ledger

thb at net-bembel.de thb at net-bembel.de
Sat Jul 9 07:28:03 BST 2022


Jack via KMyMoney-devel schrieb am 08.07.2022 18:33 (GMT +02:00):

> On 2022.07.08 03:11, thb--- via KMyMoney-devel wrote:
>> Jack via KMyMoney-devel schrieb am 07.07.2022 19:16 (GMT +02:00):
>> 
>>> I got several of these over the past days, but didn't report yet, as  
>>> I wasn't sure I was on absolute latest.  I just recompiled from git  
>>> master head, and get this (consistently) when saving an investment  
>>> transaction, where I had changed the security.  Let me know if there  
>>> is any other information which might be helpful.
>> 
>> Thanks for reporting. Despite all the details I have a problem to see  
>> where this happens. Mainly, because the backtrace does not (always)  
>> match my version of current master :(  It would be great, if you  
>> could simply specify the commit hash you are on in the future.
>> 
>> I am on 462fb8d2df6 and investtransactioneditor.cpp:1212 shows this  
>> for me
>
> I am also on this - kmymoney -v shows "kmymoney 5.1.80-462fb8d2d" and  
> here is a new BT
> 

[... bt removed ...]

>> The problem though, as Jeremy already pointed out, is a div by zero  
>> but on (my) line 1212 there is no division at all. The only one in  
>> the vicinity is three lines further down and shows
>> 
>>   d->stockSplit.setPrice(d->stockSplit.value() /  
>> d->stockSplit.shares());
>> 
>> which only gets used for a stock split transaction and price mode set  
>> to PricePerTransaction.

> Well, the BT does now point to this line, and I do have  
> PricePerTransaction set, but this is a dividend transaction, not a  
> split.  However, is this for a stock split, or if the transaction is  
> NOT a stock split?  Is there a  wrong test in that "if"?

I should have written for "non stock split transactions". My fault and
the test in that "if" is perfectly OK.

The problem is/was, that a dividend transaction should have zero in the
shares attribute of the transaction. In that case, the division cannot work.

I fixed another problem in that area, because one could edit a transaction,
make it a "buy", add shares, switch to dividend and save the transaction.
This would cause the number of shares erroneously being added to the account.
That one is also fixed with those two commits.

https://invent.kde.org/office/kmymoney/-/commit/0b0410a0ef51613824f2ddaf462efb207da478e0
https://invent.kde.org/office/kmymoney/-/commit/69de26b2640717373a40dd4191101d480ebe69ba

Thanks for all your help.

-- 

Regards

Thomas

https://www.signal.org/       Signal, the better WhatsApp
-------------------------------------------------------------
I wouldn't trust software written by anyone
who hasn't written a first level interrupt handler -- unknown
-------------------------------------------------------------


More information about the KMyMoney-devel mailing list