From 5caf42a6b1d2a9e41d145437d410955c6d2e171a Mon Sep 17 00:00:00 2001
From: Akash Mozumdar <akashmozumdar@gmail.com>
Date: Thu, 1 Nov 2018 18:47:46 -0400
Subject: [PATCH] kill everything when mainwindow is closed

---
 GUI/mainwindow.cpp | 5 +++++
 GUI/mainwindow.h   | 1 +
 2 files changed, 6 insertions(+)

diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp
index c94c238..c523829 100644
--- a/GUI/mainwindow.cpp
+++ b/GUI/mainwindow.cpp
@@ -50,6 +50,11 @@ MainWindow::~MainWindow()
 	Host::Close();
 }
 
+void MainWindow::closeEvent(QCloseEvent*)
+{
+	QCoreApplication::quit(); // Need to do this to kill any windows that might've been made by extensions
+}
+
 void MainWindow::AddProcess(unsigned processId)
 {
 	processCombo->addItem(QString::number(processId, 16).toUpper() + ": " + GetModuleName(processId));
diff --git a/GUI/mainwindow.h b/GUI/mainwindow.h
index 9494492..a9bd8c4 100644
--- a/GUI/mainwindow.h
+++ b/GUI/mainwindow.h
@@ -50,6 +50,7 @@ private:
 	DWORD GetSelectedProcessId();
 	std::unordered_map<std::string, int64_t> GetMiscInfo(TextThread* thread);
 	QVector<HookParam> GetAllHooks(DWORD processId);
+	void closeEvent(QCloseEvent*);
 
 	Ui::MainWindow* ui;
 	QSettings settings = QSettings("Textractor.ini", QSettings::IniFormat);