stop httpServer before delete; otherwise crash at exit
Change-Id: I5993b0014215ba90623f29e84ba66c8f9a925b84
diff --git a/gui/chronosharegui.cpp b/gui/chronosharegui.cpp
index 16960b3..a829099 100644
--- a/gui/chronosharegui.cpp
+++ b/gui/chronosharegui.cpp
@@ -163,6 +163,7 @@
delete m_watcher; // stop filewatching ASAP
delete m_dispatcher; // stop dispatcher ASAP, but after watcher (to prevent triggering callbacks on deleted object)
+ m_httpServer->handle_stop();
delete m_httpServer;
// cleanup
diff --git a/server/server.hpp b/server/server.hpp
index 0cb3476..408f7b9 100644
--- a/server/server.hpp
+++ b/server/server.hpp
@@ -34,6 +34,9 @@
/// Run the server's io_service loop.
void run();
+ /// Handle a request to stop the server.
+ void handle_stop();
+
private:
/// Initiate an asynchronous accept operation.
void start_accept();
@@ -41,9 +44,6 @@
/// Handle completion of an asynchronous accept operation.
void handle_accept(const boost::system::error_code& e);
- /// Handle a request to stop the server.
- void handle_stop();
-
/// The io_service used to perform asynchronous operations.
boost::asio::io_service io_service_;