Skip to contentSkip to conversation

kernel-shark: kernel-shark: Avoid a duplicate error message from capture

PATCH In review Yordan Karadzhov (VMware) 2 participants 2 messages Jul 10, 2019 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-shark: kernel-shark: Avoid a duplicate error message from capture

If the capture process finishes with an error the _captureError() slot will print an error message. We do not need to print identical message in _captureFinished().

However, we have to keep in mind that the process that we started is "pkexec" and the capture dialog is a child process of "pkexec". So if the capture dialog failed to start or crashed the "pkexec" process itself will have a normal exit, however its return value will be different from 0 (it will just pass the return value of the capture dialog executable). In this case _captureError() is not triggered, but we still want to see an error message.

---
 kernel-shark/src/KsMainWindow.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel-shark/src/KsMainWindow.cpp +1 -1
index 29d44d9..c127ad1 100644
@@ -1180,7 +1180,7 @@ void KsMainWindow::_captureFinished(int ret, QProcess::ExitStatus st)
 		return;
 	}
 
-	if (ret != 0 || st != QProcess::NormalExit) {
+	if (ret != 0 || st == QProcess::NormalExit) {
 		QString message = "Capture process failed:<br>";
 
 		message += capture->errorString();
Signature · 1 line
2.20.1

A message that is not in the archive (sent off-list or not yet received): CAE858AmPCXOTqx+80ukPMG3ovSTeoiMWSesMKR6iFVBQ+jkw_Q@mail.gmail.com

#2 lore raw
Quoted 30 lines · On Wed, 10 Jul 2019 19:00:43 +0300 Yordan Karadzhov <[email protected]> wrote:
Quoted 27 lines · On Wed, Jul 10, 2019, 18:39 Yordan Karadzhov (VMware) <[email protected]>…

If the capture process finishes with an error the _captureError() slot will print an error message. We do not need to print identical message in _captureFinished().

However, we have to keep in mind that the process that we started is "pkexec" and the capture dialog is a child process of "pkexec". So if the capture dialog failed to start or crashed the "pkexec" process itself will have a normal exit, however its return value will be different from 0 (it will just pass the return value of the capture dialog executable). In this case _captureError() is not triggered, but we still want to see an error message.

---
 kernel-shark/src/KsMainWindow.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel-shark/src/KsMainWindow.cpp +0 -0
index 29d44d9..c127ad1 100644
@@ -1180,7 +1180,7 @@ void KsMainWindow::_captureFinished(int ret,
 QProcess::ExitStatus st)
                return;
        }
 
Quoted 5 lines

kernel-shark/src/KsMainWindow.cpp void KsMainWindow::_captureFinished(int ret, QProcess::ExitStatus st) · line 1185

Quoted 3 lines
kernel-shark/src/KsMainWindow.cpp +1 -1
-       if (ret != 0 || st != QProcess::NormalExit) {
+       if (ret != 0 || st == QProcess::NormalExit) {
 

Ohh, I made stupid mistake in the rush. Must use AND instead of OR

Heh, want me to just make the fix, or can you send a v2?

-- Steve

Quoted 8 lines
                QString message = "Capture process failed:<br>";
Quoted 6 lines
kernel-shark/src/KsMainWindow.cpp +0 -1
                message += capture->errorString();
--

2.20.1