| Summary: | KCModule::save() unable to access combobox values on OK | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-kconfigwidgets | Reporter: | Sebastian Kügler <sebas> |
| Component: | general | Assignee: | kdelibs bugs <kdelibs-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | agateau, cfeck, kdelibs-bugs-null |
| Priority: | NOR | ||
| Version First Reported In: | 4.99.0 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | http://commits.kde.org/kcmutils/cc99fac3af737619ea220ccb7059f0d8f0623efa | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Sebastian Kügler
2014-05-11 22:09:28 UTC
Hm, I am probably not understanding correctly, but do you think this bug is in kcombobox (which is in kcompletion) or in kcmodule (which is in kconfigwidgets)? I think it's a bug in KCModule, I'm using QComboBox.
That's basically the following going wrong:
void KCMFormats::save()
{
// m_ui->comboBox ends up empty here when OK button is clicked from kcmshell5,
// apparently the data in the combo is gone by the time save() is called.
// This might be a problem in KCModule, but does not directly affect us
// since within systemsettings, it works fine.
// See https://bugs.kde.org/show_bug.cgi?id=334624
if (m_ui->comboBox->count() == 0) {
qWarning() << "Couldn't read data from UI, writing configuration failed.";
return;
}
//[...]
}
Thanks for the update, reassigning for further investigation. I have a fix for an issue with one of KWin KCM which looks very similar: https://git.reviewboard.kde.org/r/118639/ This patch fixes the problem, indeed. Git commit cc99fac3af737619ea220ccb7059f0d8f0623efa by Aurélien Gâteau.
Committed on 10/06/2014 at 14:40.
Pushed by gateau into branch 'master'.
KCMultiDialog: Fix crash when clicking OK
When one closes KCMultiDialog with OK, QDialog::finished() can be emitted
before the clicked() signal of the OK button. This causes the following
sequence to happen:
- KCMultiDialogPrivate::_k_dialogClosed
* deletes the KCModule
- KCModuleProxyPrivate::_k_moduleDestroyed
* sets kcm to 0
- KCMultiDialog::slotOkClicked
- KCMultiDialogPrivate::apply
- KCModuleProxy::save
- KCModuleProxyPrivate::realModule
* notices kcm is 0, so recreates it
* calls kcm->save()
- KWinDesktopConfig::save()
* crashes because it expects kcm->load() to have been called
To avoid this, trigger the cleanup code in closeEvent() rather than when
finished() is emitted, as we can be sure closeEvent() is always called
*after* the methods connected to the button box signals has executed.
REVIEW: 118639
M +15 -15 src/kcmultidialog.cpp
M +2 -1 src/kcmultidialog.h
http://commits.kde.org/kcmutils/cc99fac3af737619ea220ccb7059f0d8f0623efa
|