src/relpipe-out-chart.cpp
branchv_0
changeset 16 b6f790137bb8
parent 13 c84042d014c9
child 17 dad72beb3ebe
--- a/src/relpipe-out-chart.cpp	Sat Sep 29 12:58:04 2018 +0200
+++ b/src/relpipe-out-chart.cpp	Sat Sep 29 13:26:33 2018 +0200
@@ -24,6 +24,7 @@
 
 	WorkerThread(std::shared_ptr<RelationalReader> reader) :
 	reader(reader) {
+		setTerminationEnabled(true);
 	}
 
 	void run() {
@@ -31,6 +32,7 @@
 			reader->process();
 		} catch (RelpipeReaderException& e) {
 			// TODO: handle exception, show error dialog
+			std::wcerr << L"RelpipeReaderException: " << e.getMessge() << std::endl;
 		}
 	}
 };
@@ -67,5 +69,13 @@
 	app.exec();
 	//return app.exec();
 
+	if (t.isRunning()) {
+		std::wcerr << L"Background RelationalReader thread is still running → terminate()" << std::endl;
+		t.terminate();
+		std::wcerr << L"Background RelationalReader thread was terminated → wait()" << std::endl;
+		t.wait();
+		std::wcerr << L"Background RelationalReader thread wait() finished" << std::endl;
+	}
+
 	return resultCode;
 }