[Kmymoney-devel] CSV Importer - A new problem, crash on import

Chris DeveloperChris at rebel.com.au
Tue Apr 15 12:44:44 UTC 2014


I think I'll go to bed. I must be over tired

What I meant to say (in my head I did)
When I changed the line
640: m_startLine = profilesGroup.readEntry("StartLine", -1) + 1;
to
640: m_startLine = profilesGroup.readEntry("StartLine", 0) + 1;

Import worked flawlessly!

Chris

On 15/04/2014 10:10 PM, Chris wrote:
>
> About the email. I have checked my logs, apart from the error when I tried 
> to send the "setenv.cmd" file I have no other non deliveries to you. 
> Perhaps something at your end. I know hotmail is blocking me for some 
> unknown reason. but then they have the crappiest spam control system of 
> all the big providers, and I have given up fighting with it. Generally the 
> only mail I ever get to my hotmail account is spam. so I assume they only 
> deliver spam and block all genuine email.
>
> As for the application
>
> I changed the line
> 640: m_startLine = profilesGroup.readEntry("StartLine", -1) + 1;
> to
> 640: m_startLine = profilesGroup.readEntry("StartLine", 0) + 1;
>
> I realise a dropdown with a -1 value has no item selected. but even if 
> that is the desired outcome before passing it through to the table 
> indexing function it needs to be validated otherwise if the user fails to 
> select a starting line the same error is going to occur. I assume this is 
> checked but haven't verified it myself.
>
>
> Chris
>
>
> On 15/04/2014 9:35 PM, Allan wrote:
>> On 15/04/14 12:12, Chris wrote:
>>> Should have read...
>>>
>>> At line line 1517 it is used to initialise '*m_topLine*' which in turn
>>> is used to initialise 'row' at line 1546
>>>
>>> Chris
>>
>> Hi Chris
>>
>> I'll look into this, but just to let you know I didn't get your first 
>> email.  In fact, this one I did get is probably the one to the list.
>>
>> Just briefly, for now, the value -1 is used to obtain an empty combobox 
>> field.
>>
>> I know in several places I do check for an empty cell producing a null 
>> pointer, but will look specifically at this.
>>
>> Apart from that, it may be that it depends upon your file content, If you 
>> could provide an  edited version which shows the problem. Strange that 
>> it's OK on Kubuntu.  I assume both are based on the same source rev?
>>
>> Allan
>>
>>
>>>
>>> On 15/04/2014 8:23 PM, Chris wrote:
>>>> Hi Allan
>>>>
>>>> Hoping you can give me some insight here.
>>>>
>>>> On windows when trying to import I get an exception. The application
>>>> is trying to dereference a null pointer with the usual consequence.
>>>>
>>>> The problem is after loading the table object with the imported file
>>>> it then tries to reference the cell location [-1,0] this returns a
>>>> null pointer and thus crashes.
>>>>
>>>> I have done a trace through the code and have discovered the following.
>>>>
>>>> The csvdialog object has a field called  m_startLine which by default
>>>> is set to 1.
>>>> 101: m_startLine = 1;
>>>>
>>>> At line 640 in csvdialog.cpp it is set to default to zero if it
>>>> doesn't exist in the profile. This seems ok and I assume the +1 covers
>>>> a boundary condition
>>>> 640: m_startLine = profilesGroup.readEntry("StartLine", -1) + 1; (was
>>>> the -1 meant to be 0?)
>>>>
>>>> At line 908 it is used as a parameter and decremented to -1
>>>> 908: redrawWindow(m_startLine - 1);
>>>>
>>>> At line line 1517 it is used to initialise 'm_startLine' which in turn
>>>> is used to initialise 'row' at line 1546
>>>>
>>>> At line 1561, row (set to -1) is used to index the table
>>>> 1561: label.setText(ui->tableWidget->item(*row*, col)->text());
>>>>
>>>> At that point it throws an exception as ui->tableWidget->item(row,
>>>> col) returns a null pointer (by design) and there is no checking of
>>>> the return value nor checking of the index before it is used.
>>>>
>>>> I assume this is a bug. What I am not sure about is what it should
>>>> have been set to to start with -1, 0 or 1? as I said the default
>>>> before loading a profile is 1.
>>>>
>>>> What really confuses me is on kubuntu I don't get an error with the
>>>> same import file (actually it crashed the first time, but didn't again
>>>> after I recreated the profile).
>>>>
>>>> Can you please advise where the error seems to be?
>>>>
>>>> Chris
>>>
>>>
>>
>>
>
>
>



More information about the KMyMoney-devel mailing list