Skip to contentSkip to conversation

kernelshark: Avoid nullptr deref in _graphFollowsChanged

PATCH New Ruben Devos 1 participant 1 message Dec 29, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernelshark: Avoid nullptr deref in _graphFollowsChanged

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

---
 src/KsTraceViewer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/KsTraceViewer.cpp +1 -1
index d4bf5f1..6efba7d 100644
@@ -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()
Signature · 1 line
2.47.1