Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 7/8] kernel-shark: Disconnect "capture errors" before closing KernelShark GUI
Date: Tue,  9 Jul 2019 18:56:49 +0300
Message-ID: <20190709155650.2345-8-y.karadz@gmail.com> (raw)
In-Reply-To: <20190709155650.2345-1-y.karadz@gmail.com>

This is done because we do not want to show error messages if the Capture
dialog is not closed.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsMainWindow.cpp | 15 +++++++++++++--
 kernel-shark/src/KsMainWindow.hpp |  2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 3f238db..55518a3 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -155,6 +155,16 @@ KsMainWindow::~KsMainWindow()
 
 	_data.clear();
 
+	/*
+	 * Do not show error messages if the "capture" process is still
+	 * running (Capture dialog is not closed).
+	 */
+	if (_capture.state() != QProcess::NotRunning) {
+		disconnect(_captureErrorConnection);
+		_capture.close();
+		_capture.waitForFinished();
+	}
+
 	if (kshark_instance(&kshark_ctx))
 		kshark_free(kshark_ctx);
 }
@@ -1129,8 +1139,9 @@ void KsMainWindow::_initCapture()
 	connect(&_capture,	SIGNAL(finished(int, QProcess::ExitStatus)),
 		this,		SLOT(_captureFinished(int, QProcess::ExitStatus)));
 
-	connect(&_capture,	&QProcess::errorOccurred,
-		this,		&KsMainWindow::_captureError);
+	_captureErrorConnection =
+		connect(&_capture,	&QProcess::errorOccurred,
+			this,		&KsMainWindow::_captureError);
 
 	connect(&_captureLocalServer,	&QLocalServer::newConnection,
 		this,			&KsMainWindow::_readSocket);
diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp
index 22700d9..62e66a0 100644
--- a/kernel-shark/src/KsMainWindow.hpp
+++ b/kernel-shark/src/KsMainWindow.hpp
@@ -159,6 +159,8 @@ private:
 
 	QSettings	_settings;
 
+	QMetaObject::Connection		_captureErrorConnection;
+
 	void _open();
 
 	void _restoreSession();
-- 
2.20.1


  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 15:56 [PATCH 0/8]Fixes needed befor KS 1.0 Yordan Karadzhov (VMware)
2019-07-09 15:56 ` [PATCH 1/8] kernel-shark: Don't free the string field of KS_CONFIG_STRING document Yordan Karadzhov (VMware)
2019-07-09 15:56 ` [PATCH 2/8] kernel-shark: Add method for getting all selected events Yordan Karadzhov (VMware)
2019-07-09 15:56 ` [PATCH 3/8] kernel-shark: Optimize the command line options used by the capture dialog Yordan Karadzhov (VMware)
2019-07-09 15:56 ` [PATCH 4/8] kernel-shark: Don't try to open data file if recording failed Yordan Karadzhov (VMware)
2019-07-09 15:56 ` [PATCH 5/8] kernel-shark: Remove a duplicate error message Yordan Karadzhov (VMware)
2019-07-09 15:56 ` [PATCH 6/8] kernel-shark: remove the "make install" suggestion for capture errors Yordan Karadzhov (VMware)
2019-07-10  1:36   ` Steven Rostedt
2019-07-09 15:56 ` Yordan Karadzhov (VMware) [this message]
2019-07-09 15:56 ` [PATCH 8/8] kernel-shark: Less scary error message from Capture dialog Yordan Karadzhov (VMware)

Reply instructions:

You may reply publically 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=20190709155650.2345-8-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org linux-trace-devel@archiver.kernel.org
	public-inbox-index linux-trace-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox