Commit e6ee67c2 authored by Dan Weatherill's avatar Dan Weatherill Committed by Kevin Funk

work around bug in kLineEdit

Summary:
a bug in kLineEdit causes spurious emission of textEdited signals when calling setText().

This in turn causes spurious calls of compilerEdited() when selecting a compiler in the compilers window,
 which leads to a segfault (e.g. this bug https://bugs.kde.org/show_bug.cgi?id=373004) and I think some duplicates also.

I have submitted also a patch to kcompletion, https://phabricator.kde.org/D9808

This is a workaround for those systems until that is fixed

Reviewers: #kdevelop, apol, mwolff

Reviewed By: #kdevelop, mwolff

Subscribers: mwolff, anthonyfieroni, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D9809
BUG: 373004
FIXED-IN: 5.2.2
parent 2adeca0d
......@@ -25,6 +25,7 @@
#include <QTest>
#include <QTemporaryFile>
#include <QSignalBlocker>
#include <tests/autotestshell.h>
#include <tests/testcore.h>
......
......@@ -33,6 +33,7 @@
#include <QKeySequence>
#include <QMenu>
#include <QSignalMapper>
#include <QSignalBlocker>
#include "ui_compilerswidget.h"
#include "compilersmodel.h"
......@@ -162,7 +163,15 @@ void CompilersWidget::compilerSelected(const QModelIndex& index)
auto compiler = index.data(CompilersModel::CompilerDataRole);
if (compiler.value<CompilerPointer>()) {
m_ui->compilerName->setText(compiler.value<CompilerPointer>()->name());
//NOTE: there is a bug in kLineEdit, which causes textEdited signal to be
// spuriously emitted on calling setText(). See bug report here:
// https://bugs.kde.org/show_bug.cgi?id=388798
// The resulting spurious call of compilerEdited then fails with an assert.
//Work around this bug until it is fixed upstream by disabling signals here
const QSignalBlocker blocker(m_ui->compilerPath);
m_ui->compilerPath->setText(compiler.value<CompilerPointer>()->path());
enableItems(true);
} else {
enableItems(false);
......@@ -194,6 +203,10 @@ void CompilersWidget::enableItems(bool enable)
if(!enable) {
m_ui->compilerName->clear();
//NOTE: this is to work around the
//spurious signal bug in kLineEdit
const QSignalBlocker blocker(m_ui->compilerPath);
m_ui->compilerPath->clear();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment