diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2019-08-01 17:05:45 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2019-08-03 23:22:24 +0200 |
commit | a19ca805b669e20e5f3712cb9420726c965dc4bf (patch) | |
tree | a15b0bfa1d9f56f65dbed21b475278591310cfd3 /src | |
parent | ed9dea417c1346183de52782459eb0b697778245 (diff) | |
download | qtapplicationmanager-a19ca805b669e20e5f3712cb9420726c965dc4bf.tar.gz |
Cleanup the NativeRuntime exit status handling
The console message for a forced quit of an AM app always stated
'CrashExit', which was wrong - the correct 'ForceExit' status was
only calculated afterwards.
Change-Id: I69f896a944b3bccf04cf8eff965f2785dab6c55a
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/manager-lib/application.cpp | 18 | ||||
-rw-r--r-- | src/manager-lib/nativeruntime.cpp | 5 |
2 files changed, 7 insertions, 16 deletions
diff --git a/src/manager-lib/application.cpp b/src/manager-lib/application.cpp index 722ad753..c5b0c59a 100644 --- a/src/manager-lib/application.cpp +++ b/src/manager-lib/application.cpp @@ -49,9 +49,6 @@ #include <QDebug> -#if defined(Q_OS_UNIX) -# include <signal.h> -#endif /*! \qmltype ApplicationObject @@ -467,19 +464,8 @@ void Application::setLastExitCodeAndStatus(int exitCode, Am::ExitStatus exitStat emit lastExitCodeChanged(); } - Am::ExitStatus newStatus; - if (exitStatus == Am::CrashExit) { -#if defined(Q_OS_UNIX) - newStatus = (exitCode == SIGTERM || exitCode == SIGKILL) ? Am::ForcedExit : Am::CrashExit; -#else - newStatus = Am::CrashExit; -#endif - } else { - newStatus = Am::NormalExit; - } - - if (m_lastExitStatus != newStatus) { - m_lastExitStatus = newStatus; + if (m_lastExitStatus != exitStatus) { + m_lastExitStatus = exitStatus; emit lastExitStatusChanged(); } } diff --git a/src/manager-lib/nativeruntime.cpp b/src/manager-lib/nativeruntime.cpp index 7fffb626..f32c7ff2 100644 --- a/src/manager-lib/nativeruntime.cpp +++ b/src/manager-lib/nativeruntime.cpp @@ -75,6 +75,7 @@ QT_BEGIN_NAMESPACE_AM QT_END_NAMESPACE_AM # include <dlfcn.h> # include <sys/socket.h> +# include <signal.h> QT_BEGIN_NAMESPACE_AM static qint64 getDBusPeerPid(const QDBusConnection &conn) @@ -223,6 +224,10 @@ bool NativeRuntime::initialize() void NativeRuntime::shutdown(int exitCode, Am::ExitStatus status) { + // see NativeRuntime::stop() below + if ((status == Am::CrashExit) && (exitCode == SIGTERM || exitCode == SIGKILL)) + status = Am::ForcedExit; + if (!m_isQuickLauncher || m_connectedToRuntimeInterface) { qCDebug(LogSystem) << "NativeRuntime (id:" << (m_app ? m_app->id() : qSL("(none)")) << "pid:" << m_process->processId() << ") exited with code:" << exitCode |