This does not affect the stable releases.
If a file with say three columns, that is with just a single 'Amount column', is loaded after a file with Debit and Credit columns was previously loaded, then during the process of column selection, when the Amount radio button is clicked, KMyMoney crashes.
Steps to Reproduce:
1. Import a file which has debit and credit columns.
2. Exit the plugin so that the settings are saved.
3. Load a file which has just the single Amount column.
4. The Amount column radio should be showing as deselected and the Debit/credit columns radio should be showing as selected.
5. Click the Amount radio button.
6. KMM crashes.
KMM should not crash.
When the Amount column radio is clicked, the routine CSVDialog::amountRadioClicked() is entered. The m_debitColumn and m_creditColumn integers are set to -1, that is set to invalid. However, before this action, a check is made - "the 'm_creditColumn and m_debitColumn' could just have been reassigned, so ensure they == "credit or debit" before clearing them".
so, before the current settings are cleared, they are actually used for this check.
Unfortunately, it is likely that one or both of them points to a now non-existent column, causing the m_columnTypeList QStringList to go out of bounds, resulting in the crash.
The use of a QStringList for this check needs to be changed to an indexOf() operation.
Created attachment 83582 [details]
Patch file for this bug. Needed fix also if debitCreditRadioClicked() in similar circumstances.
Waiting on prior reviewboard before pushing this.
Git commit 243a5994583e91bf1c2e166abecfec74bf87d7a9 by Allan Anderson.
Committed on 28/12/2013 at 13:50.
Pushed by allananderson into branch 'master'.
M +6 -6 kmymoney/plugins/csvimport/csvdialog.cpp