From 1e16a9775adb6eab5f248712314527c6001eac31 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Sat, 8 Jun 2019 19:03:20 +0300
Subject: [PATCH] Minor corrections to reconstruct main

---
 applications/gui/src/main.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/applications/gui/src/main.cpp b/applications/gui/src/main.cpp
index 184e38c88..164a74b8d 100644
--- a/applications/gui/src/main.cpp
+++ b/applications/gui/src/main.cpp
@@ -62,8 +62,8 @@ int main(int argc, char **argv) {
 	net->start();
 	//net->waitConnections();
 
-	ftl::ctrl::Master controller(root, net);
-	controller.onLog([](const ftl::ctrl::LogEvent &e){
+	ftl::ctrl::Master *controller = new ftl::ctrl::Master(root, net);
+	controller->onLog([](const ftl::ctrl::LogEvent &e){
 		const int v = e.verbosity;
 		switch (v) {
 		case -2:	LOG(ERROR) << "Remote log: " << e.message; break;
@@ -81,7 +81,7 @@ int main(int argc, char **argv) {
 		nanogui::init();
 
 		/* scoped variables */ {
-			nanogui::ref<FTLApplication> app = new FTLApplication(root, net, &controller);
+			nanogui::ref<FTLApplication> app = new FTLApplication(root, net, controller);
 			app->drawAll();
 			app->setVisible(true);
 			nanogui::mainloop();
@@ -98,6 +98,8 @@ int main(int argc, char **argv) {
 		return -1;
 	}
 
+	net->shutdown();
+	delete controller;
 	delete net;
 	delete root;
 
-- 
GitLab