Summary: | KLineEdit emits textChanged signal when setText() or clear() is called | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kcompletion | Reporter: | Dan Weatherill <plasteredparrot> |
Component: | general | Assignee: | David Gil <davidgiloliva> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | kdelibs-bugs, simonandric5 |
Priority: | NOR | ||
Version: | 5.32.0 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
URL: | https://phabricator.kde.org/D9808 | ||
Latest Commit: | https://commits.kde.org/kcompletion/31f226116f99bcf40ddc67fe6328594d5fb46222 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: | minimal example which reproduces the bug |
I have confirmed this issue still exists building against git master kcompletions (SHA1: c351ff8be4f2bc84f) and latest Qt (5.10.0). Git commit 31f226116f99bcf40ddc67fe6328594d5fb46222 by David Faure, on behalf of Dan Weatherill. Committed on 19/01/2018 at 08:48. Pushed by dfaure into branch 'master'. Fix incorrect emission of textEdited() by KLineEdit The unit test of kLineEdit was previously checking incorrectly that textEdited _HAD_ been emitted when the text is changed with setText(). This is undesired behaviour. This patch fixes the unit test, and changes the problematic behaviour by removing the extra emission of textEdited in the private signal _k_textChanged. In addition this is the underlying cause of a bug in kdevelop (and probably several others). Related: bug 373004 M +28 -3 autotests/klineedit_unittest.cpp M +0 -1 src/klineedit.cpp https://commits.kde.org/kcompletion/31f226116f99bcf40ddc67fe6328594d5fb46222 |
Created attachment 109786 [details] minimal example which reproduces the bug Hi, whilst debugging a segfault in kdevelop, I found this is the cause. I created a simple test case GUI which has a KLineEdit, a KUrlRequester, and a QLineEdit (source attached). On my system (Qt 5.6.2, KDE frameworks 5.32.0, openSUSE Leap 42.3), when the "test edited" or "test clear" buttons are pressed, QLineEdit correctly only emits the textChanged signal, but KUrlRequester and KLineEdit emit both textChanged (expected) and also textEdited (spurious). This signal should only (as per the docs) be emitted when the user themselves edits the box. I searched the git logs and couldn't see any fix related to this up to now. I have not yet checked newer versions to see if the problem is still there.