Terminate the application correctly
This commit is contained in:
parent
f2d2a41b6c
commit
2853f7ae9b
1 changed files with 7 additions and 3 deletions
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#include <boost/throw_exception.hpp>
|
#include <boost/throw_exception.hpp>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
namespace anbox {
|
namespace anbox {
|
||||||
namespace ubuntu {
|
namespace ubuntu {
|
||||||
WindowCreator::WindowCreator(const std::shared_ptr<input::Manager> &input_manager) :
|
WindowCreator::WindowCreator(const std::shared_ptr<input::Manager> &input_manager) :
|
||||||
|
|
@ -50,9 +53,10 @@ void WindowCreator::process_events() {
|
||||||
while (SDL_WaitEventTimeout(&event, 100)) {
|
while (SDL_WaitEventTimeout(&event, 100)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
// FIXME: We exit here only as long as we don't have multi window
|
// This is the best way to reliable terminate the whole application for now. It will
|
||||||
// support.
|
// trigger a correct shutdown in the main part.
|
||||||
BOOST_THROW_EXCEPTION(std::runtime_error("User closed main application window"));
|
::kill(getpid(), SIGTERM);
|
||||||
|
break;
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
process_window_event(event);
|
process_window_event(event);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue