From dd7967dede3ac8728e00bc15d4e8d0b3f22b0cc2 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Mon, 31 Oct 2016 01:25:45 +0100 Subject: [PATCH] fix(controller): Check for connection error in eventloop --- include/components/controller.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/components/controller.hpp b/include/components/controller.hpp index 96894b27..18d844e9 100644 --- a/include/components/controller.hpp +++ b/include/components/controller.hpp @@ -335,14 +335,16 @@ class controller { m_connection.flush(); - while (true) { + while (m_running) { shared_ptr evt; - if ((evt = m_connection.wait_for_event())) - m_connection.dispatch_event(evt); - - if (!m_running) + if (m_connection.connection_has_error()) { break; + } + + if ((evt = m_connection.wait_for_event())) { + m_connection.dispatch_event(evt); + } } }