[Pkg-kde-extras] Bug#694868: kmymoney: After configuring reports in Polish, Save causes segfault and loss of user profile

Andrey Rahmatullin wrar at wrar.name
Sun Dec 2 11:11:00 UTC 2012


Control: tags -1 + confirmed upstream

On Sat, Dec 01, 2012 at 03:18:58PM +0100, Mirosław Zalewski wrote:
> Package: kmymoney
> Version: 4.6.2-3.1
> Severity: grave
> 
> Steps to reproduce:
> 1. touch /tmp/new.kmy
> 2. kmymoney --lang pl /tmp/new.kmy
> 3. choose any currency from list
Here you need to press the first button which is "set as default".

> 4. Go to "Raporty" (Reports). Choose any report, right click and choose
>    "Konfiguracja" (Configure)
Looks like it doesn't crash with some reports. It does with he first one
though.

> I am attaching crashlog from Dr. Konqui. I have kmymoney-dev installed,
> but it doesn't seem to provide meaningful information.
You need kmymoney-dbg.

This is a proper bt:

(gdb) bt
#0  QString::operator= (this=0x5e18920, other=...) at tools/qstring.cpp:1410
#1  0x00007ffff4a74d22 in QDomAttrPrivate::setNodeValue (this=0x5e188e0, v=...) at dom/qdom.cpp:4137
#2  0x00007ffff4a7b9a6 in QDomElementPrivate::setAttribute (this=0x5d3b120, aname=..., newValue=...) at dom/qdom.cpp:4479
#3  0x00007ffff7b98b48 in MyMoneyReport::write (this=this at entry=0x5d4db60, e=..., doc=doc at entry=0xecd070, anonymous=anonymous at entry=false)
    at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/mymoney/mymoneyreport.cpp:362
#4  0x00007ffff7b99831 in MyMoneyReport::writeXML (this=0x5d4db60, document=..., parent=...) at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/mymoney/mymoneyreport.cpp:741
#5  0x00000000007960c7 in MyMoneyStorageXML::writeReports (this=0x5fdcc90, parent=...) at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/mymoney/storage/mymoneystoragexml.cpp:776
#6  0x00000000007949fb in MyMoneyStorageXML::writeFile (this=0x5fdcc90, qf=0x5d0fdd0, storage=<optimized out>) at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/mymoney/storage/mymoneystoragexml.cpp:515
#7  0x00000000004aa0de in KMyMoneyView::saveToLocalFile (this=this at entry=0xf2cc10, localFile=..., pWriter=pWriter at entry=0x5fdcc90, plaintext=160, plaintext at entry=false, keyList=...)
    at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/views/kmymoneyview.cpp:1190
#8  0x00000000004ab0c9 in KMyMoneyView::saveFile (this=0xf2cc10, url=..., keyList=...) at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/views/kmymoneyview.cpp:1265
#9  0x0000000000482c3f in KMyMoneyApp::slotFileSave (this=0xd4f5a0) at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/kmymoney.cpp:1570


(gdb) fr 3
#3  0x00007ffff7b98b48 in MyMoneyReport::write (this=this at entry=0x5d4db60, e=..., doc=doc at entry=0xecd070, anonymous=anonymous at entry=false)
    at /build/buildd-kmymoney_4.6.2-3.1-amd64-N_PinZ/kmymoney-4.6.2/kmymoney/mymoney/mymoneyreport.cpp:362
362         e.setAttribute("detail", kDetailLevelText[m_detailLevel]);
(gdb) p m_detailLevel
$2 = 32767


i.e. m_detailLevel == -1 while it shouldn't be negative (it's enum EDetailLevel
defined in kmymoney/mymoney/mymoneyreport.h).

Some grepping shows that m_detailLevel is set in the configuration dialog
based on the m_comboDetail selected value without validation:

kmymoney/dialogs/kreportconfigurationfilterdlg.cpp::KReportConfigurationFilterDlg::slotSearch():
  m_currentState.setDetailLevel(dl[m_tab2->findChild<KComboBox*>("m_comboDetail")->currentIndex()]);

Now if we look at that combo (it's on the second tab of the dialog) in the
Polish l10n, it doesn't have a selected value (as opposed to the Russian
l10n).

The default value for that combo is set in
KReportConfigurationFilterDlg::slotReset(). The default detailLevel() is
eDetailAll so it's trying to find the result of i18nc("All accounts",
"All") in the combo. 

Checking the .po. This is the string from the code that selects the value
in the combo:

#: kmymoney/dialogs/kreportconfigurationfilterdlg.cpp:290
msgctxt "All accounts"
msgid "All"
msgstr "Wszystko"


This is the string from the .ui that fills the combo values:

#. i18n: file: kmymoney/widgets/kmymoneyreportconfigtab2decl.ui:47
#. i18n: ectx: property (text), item, widget (KComboBox, m_comboDetail)
#: rc.cpp:3445
msgctxt "@item all accounts"
msgid "All"
msgstr "Wszystkie"



So there are several problems.

1. The code in KReportConfigurationFilterDlg::slotSearch() passes
unchecked values to setDetailLevel, it should compare it to -1.
2. The code in KReportConfigurationFilterDlg::slotReset() doesn't have a
fallback and can leave m_comboDetail without a selected value.
3. pl.po and possibly other langs have different values for the combo item
and the constant from the comparison.

I also feel that it's wrong to have different contexts for that two
strings if they are compared but I don't know best practices for Qt
localization. 



-- 
WBR, wRAR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-kde-extras/attachments/20121202/ece53bf7/attachment.pgp>


More information about the pkg-kde-extras mailing list