diff mbox series

[4/8] kernel-shark: Don't try to open data file if recording failed

Message ID 20190709155650.2345-5-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series Fixes needed befor KS 1.0 | expand

Commit Message

Yordan Karadzhov July 9, 2019, 3:56 p.m. UTC
In the case when the recording process failed, the Capture dialog should
not send a signal to the KernelShark GUI to open a new tracing data file.

Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsCaptureDialog.cpp | 10 +++++++++-
 kernel-shark/src/KsCaptureDialog.hpp |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel-shark/src/KsCaptureDialog.cpp b/kernel-shark/src/KsCaptureDialog.cpp
index 7da6c08..c877094 100644
--- a/kernel-shark/src/KsCaptureDialog.cpp
+++ b/kernel-shark/src/KsCaptureDialog.cpp
@@ -314,6 +314,7 @@  KsCaptureMonitor::KsCaptureMonitor(QWidget *parent)
 : QWidget(parent),
   _mergedChannels(false),
   _argsModified(false),
+  _captureStatus(false),
   _panel(this),
   _name("Output display", this),
   _space("max size ", this),
@@ -448,6 +449,9 @@  void KsCaptureMonitor::_captureFinished(int exit, QProcess::ExitStatus status)
 		_consolOutput.appendPlainText(errMessage);
 
 		QCoreApplication::processEvents();
+		_captureStatus = false;
+	} else {
+		_captureStatus = true;
 	}
 }
 
@@ -531,8 +535,12 @@  void KsCaptureDialog::_setChannelMode(int state)
 
 void KsCaptureDialog::_sendOpenReq(const QString &fileName)
 {
-	QLocalSocket *socket = new QLocalSocket(this);
+	QLocalSocket *socket;
+
+	if (!_captureMon._captureStatus)
+		return;
 
+	socket = new QLocalSocket(this);
 	socket->connectToServer("KSCapture", QIODevice::WriteOnly);
 	if (socket->waitForConnected()) {
 		QByteArray block;
diff --git a/kernel-shark/src/KsCaptureDialog.hpp b/kernel-shark/src/KsCaptureDialog.hpp
index 2265704..b168a2b 100644
--- a/kernel-shark/src/KsCaptureDialog.hpp
+++ b/kernel-shark/src/KsCaptureDialog.hpp
@@ -119,6 +119,8 @@  public:
 	 */
 	bool		_argsModified;
 
+	bool		_captureStatus;
+
 private:
 	QVBoxLayout	_layout;