diff mbox series

kernelshark: Avoid nullptr deref in _graphFollowsChanged

Message ID 20241229192155.33113-1-devosruben6@gmail.com (mailing list archive)
State Accepted
Commit f6f547c54c4f3fa49dfe9a008140c0297854db8d
Headers show
Series kernelshark: Avoid nullptr deref in _graphFollowsChanged | expand

Commit Message

Ruben Devos Dec. 29, 2024, 7:21 p.m. UTC
In _graphFollowsChanged, _it will be null as long as the search function
is not used.
Use row instead to send a signal to the graph widget when toggling the
"Graph follows" checkbox to avoid a nullptr dereference / segfault.
This will also make sure the marker on the graph points to the correct
event when the user selects another event afer using the search
function.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=219637
Signed-off-by: Ruben Devos <devosruben6@gmail.com>
---
 src/KsTraceViewer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/KsTraceViewer.cpp b/src/KsTraceViewer.cpp
index d4bf5f1..6efba7d 100644
--- a/src/KsTraceViewer.cpp
+++ b/src/KsTraceViewer.cpp
@@ -311,7 +311,7 @@  void KsTraceViewer::_graphFollowsChanged(int state)
 
 	_graphFollows = (bool) state;
 	if (_graphFollows && row != KS_NO_ROW_SELECTED)
-		emit select(*_it); // Send a signal to the Graph widget.
+		emit select(row); // Send a signal to the Graph widget.
 }
 
 void KsTraceViewer::_search()