summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMurray Read <ext-murray.2.read@nokia.com>2012-03-07 11:47:41 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-03-07 23:40:03 (GMT)
commit0ef9762bbb176c842a90bc5aaad49a7f2b054ad6 (patch)
tree0ba00744201912aa509c2afa166a9efe916d40d9 /src/corelib
parent3a57243fbffb771c0991c99d93ac9b9fcf4fc4ee (diff)
downloadQt-0ef9762bbb176c842a90bc5aaad49a7f2b054ad6.zip
Qt-0ef9762bbb176c842a90bc5aaad49a7f2b054ad6.tar.gz
Qt-0ef9762bbb176c842a90bc5aaad49a7f2b054ad6.tar.bz2
Don't allow app panic on QProcess destruction, kill or terminate
QProcess destruction will call kill() if the process is still running. PRocess::Kill() and Terminate() both require the PowerMgmt capability to operate on Symbian, otherwise a KERN-EXEC 46 panic happens. An app should be able to use QProcess safely if it doesn't have PowerMgmt capability, it should just be prevented from trying to kill the created process. Now a debug message is issued on ~QProcess(), kill() or terminate() if the capability is not present, rather than actually trying to kill/terminate the process. Task-number: ou1cimx1#985227 Change-Id: I3242ca2c39528c70c2c79e39f6a6384dd72f6ae6 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qprocess_symbian.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index 2ed7fe6..c483b76 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -890,10 +890,14 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
void QProcessPrivate::terminateProcess()
{
- // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise.
+ // Needs PowerMgmt capability if process has been started; will issue a debug message otherwise.
// Always works if process is not yet started.
if (qt_rprocess_running(symbianProcess)) {
- symbianProcess->Terminate(0);
+ if (RProcess().HasCapability(ECapabilityPowerMgmt)) {
+ symbianProcess->Terminate(0);
+ } else {
+ qWarning("QProcessPrivate::terminateProcess(), can't terminate process without PowerMgmt capability");
+ }
} else {
QPROCESS_DEBUG_PRINT("QProcessPrivate::terminateProcess(), Process not running");
}
@@ -901,10 +905,14 @@ void QProcessPrivate::terminateProcess()
void QProcessPrivate::killProcess()
{
- // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise.
+ // Needs PowerMgmt capability if process has been started; will issue a debug message otherwise.
// Always works if process is not yet started.
if (qt_rprocess_running(symbianProcess)) {
- symbianProcess->Kill(0);
+ if (RProcess().HasCapability(ECapabilityPowerMgmt)) {
+ symbianProcess->Kill(0);
+ } else {
+ qWarning("QProcessPrivate::killProcess(), can't kill process without PowerMgmt capability");
+ }
} else {
QPROCESS_DEBUG_PRINT("QProcessPrivate::killProcess(), Process not running");
}