[PATCH v2 8/8] kernel-shark: Handle the case when the marker points to a filtered entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Markers can point to entries that are filtered out. When switching
the marker it may happen that new Active Marker points to an entry
that is filtered. In this case no actions must be taken and a warning
message for the user must be displayed.

Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
---
 kernel-shark/src/KsTraceViewer.cpp | 27 +++++++++++++++++----------
 kernel-shark/src/KsTraceViewer.hpp |  2 ++
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/kernel-shark/src/KsTraceViewer.cpp b/kernel-shark/src/KsTraceViewer.cpp
index 04a38b8..85da64f 100644
--- a/kernel-shark/src/KsTraceViewer.cpp
+++ b/kernel-shark/src/KsTraceViewer.cpp
@@ -61,7 +61,8 @@ KsTraceViewer::KsTraceViewer(QWidget *parent)
   _graphFollowsCheckBox(this),
   _graphFollows(true),
   _mState(nullptr),
-  _data(nullptr)
+  _data(nullptr),
+  _em(this)
 {
 	this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
 
@@ -493,15 +494,21 @@ void KsTraceViewer::markSwitch()
 		QModelIndex index =
 			_proxyModel.mapFromSource(_model.index(row, 0));
 
-		/*
-		 * The row of the active marker will be colored according to
-		 * the assigned property of the current state of the Dual
-		 * marker. Auto-scrolling is temporarily disabled because we
-		 * do not want to scroll to the position of the marker yet.
-		 */
-		_view.setAutoScroll(false);
-		_view.selectRow(index.row());
-		_view.setAutoScroll(true);
+		if (index.isValid()) {
+			/*
+			 * The row of the active marker will be colored according to
+			 * the assigned property of the current state of the Dual
+			 * marker. Auto-scrolling is temporarily disabled because we
+			 * do not want to scroll to the position of the marker yet.
+			 */
+			_view.setAutoScroll(false);
+			_view.selectRow(index.row());
+			_view.setAutoScroll(true);
+		} else {
+			_view.clearSelection();
+			QString err("The marker's entry is filtered out.");
+			_em.showMessage(err);
+		}
 	} else {
 		_view.clearSelection();
 	}
diff --git a/kernel-shark/src/KsTraceViewer.hpp b/kernel-shark/src/KsTraceViewer.hpp
index cf529ba..15eee50 100644
--- a/kernel-shark/src/KsTraceViewer.hpp
+++ b/kernel-shark/src/KsTraceViewer.hpp
@@ -119,6 +119,8 @@ private:
 
 	KsDataStore		*_data;
 
+	QErrorMessage	_em;
+
 	enum Condition
 	{
 		Containes = 0,
-- 
2.19.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux