All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ruben Devos <devosruben6@gmail.com>
To: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com
Cc: Ruben Devos <devosruben6@gmail.com>
Subject: [PATCH] kernelshark: Avoid nullptr deref in _graphFollowsChanged
Date: Sun, 29 Dec 2024 20:21:55 +0100	[thread overview]
Message-ID: <20241229192155.33113-1-devosruben6@gmail.com> (raw)

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 --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()
-- 
2.47.1


                 reply	other threads:[~2024-12-29 19:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241229192155.33113-1-devosruben6@gmail.com \
    --to=devosruben6@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.