on xenial help sign in
Make unity8 and unity8-dash handle termination signals
3190fb9Albert Astals Cid
src/CMakeLists.txt+1
@@ -24,6 +24,7 @@ set(SOURCE_FILES
24 ShellApplication.cpp
24 ShellApplication.cpp
25 ShellView.cpp
25 ShellView.cpp
26 UnityCommandLineParser.cpp
26 UnityCommandLineParser.cpp
27+ unix-signal-handler.cpp
27 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
28 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
28)
29)
29
30
src/Dash/CMakeLists.txt+1
@@ -1,6 +1,7 @@
1set(DASH_SRCS
1set(DASH_SRCS
2 main.cpp
2 main.cpp
3 ../CachingNetworkManagerFactory.cpp
3 ../CachingNetworkManagerFactory.cpp
4+ ../unix-signal-handler.cpp
4)
5)
5
6
6if (ENABLE_TOUCH_EMULATION)
7if (ENABLE_TOUCH_EMULATION)
src/Dash/main.cpp+6
@@ -32,6 +32,7 @@
32 #include "../MouseTouchAdaptor.h"
32 #include "../MouseTouchAdaptor.h"
33#endif
33#endif
34#include "../CachingNetworkManagerFactory.h"
34#include "../CachingNetworkManagerFactory.h"
35+#include "../unix-signal-handler.h"
35
36
36int main(int argc, const char *argv[])
37int main(int argc, const char *argv[])
37{
38{
@@ -116,6 +117,11 @@ int main(int argc, const char *argv[])
116 view->setSource(source);
117 view->setSource(source);
117 view->show();
118 view->show();
118
119
120+ UnixSignalHandler signal_handler([]{
121+ QGuiApplication::exit(0);
122+ });
123+ signal_handler.setupUnixSignalHandlers();
124+
119 int result = application->exec();
125 int result = application->exec();
120
126
121 delete view;
127 delete view;
src/main.cpp+6
@@ -17,6 +17,7 @@
17// local
17// local
18#include "ShellApplication.h"
18#include "ShellApplication.h"
19#include "qmldebuggerutils.h"
19#include "qmldebuggerutils.h"
20+#include "unix-signal-handler.h"
20
21
21int main(int argc, const char *argv[])
22int main(int argc, const char *argv[])
22{
23{
@@ -32,6 +33,11 @@ int main(int argc, const char *argv[])
32
33
33 ShellApplication *application = new ShellApplication(argc, (char**)argv, isMirServer);
34 ShellApplication *application = new ShellApplication(argc, (char**)argv, isMirServer);
34
35
36+ UnixSignalHandler signal_handler([]{
37+ QGuiApplication::exit(0);
38+ });
39+ signal_handler.setupUnixSignalHandlers();
40+
35 int result = application->exec();
41 int result = application->exec();
36
42
37 application->destroyResources();
43 application->destroyResources();
tools/unix-signal-handler.cpp → src/unix-signal-handler.cpprenamed

The content is the same.

tools/unix-signal-handler.h → src/unix-signal-handler.hrenamed

The content is the same.

tools/CMakeLists.txt+1−1
@@ -1,7 +1,7 @@
1add_executable(${SCOPE_TOOL}
1add_executable(${SCOPE_TOOL}
2 scopetool.cpp
2 scopetool.cpp
3 registry-tracker.cpp
3 registry-tracker.cpp
4− unix-signal-handler.cpp
4+ ../src/unix-signal-handler.cpp
5 )
5 )
6
6
7qt5_use_modules(${SCOPE_TOOL} Qml Quick)
7qt5_use_modules(${SCOPE_TOOL} Qml Quick)
tools/scopetool.cpp+1−1
@@ -32,7 +32,7 @@
32// local
32// local
33#include <paths.h>
33#include <paths.h>
34#include "registry-tracker.h"
34#include "registry-tracker.h"
35−#include "unix-signal-handler.h"
35+#include "../src/unix-signal-handler.h"
36
36
37
37
38int main(int argc, char *argv[])
38int main(int argc, char *argv[])