diff mbox series

[v2,4/8] kernel-shark-qt: Avoid spurious searches

Message ID 20181214125212.9637-5-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Headers show
Series More modifications toward KS 1.0 | expand

Commit Message

Yordan Karadzhov Dec. 14, 2018, 12:52 p.m. UTC
We do not want to search if the text field of search panel is empty.
Most probably this is an accidental key press or mouse click.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsTraceViewer.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp
index aeed5f7..971793f 100644
--- a/kernel-shark-qt/src/KsTraceViewer.cpp
+++ b/kernel-shark-qt/src/KsTraceViewer.cpp
@@ -331,6 +331,15 @@  void KsTraceViewer::_search()
 
 		_matchList.clear();
 		xText = _searchLineEdit.text();
+		if (xText.isEmpty()) {
+			/*
+			 * No text is provided by the user. Most probably this
+			 * is an accidental key press. Just reenable the input.
+			 */
+			_lockSearchPanel(false);
+			return;
+		}
+
 		xColumn = _columnComboBox.currentIndex();
 		xSelect = _selectComboBox.currentIndex();