summaryrefslogtreecommitdiffstats
path: root/application/MultiMC.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-07-05 19:45:10 +0200
committerPetr Mrázek <peterix@gmail.com>2017-07-05 19:45:10 +0200
commit26f7f017d4bac569b62b9186d4ec5427ac755756 (patch)
treee2d9d6cfa57b0ed465acbb579fbbc775ce005833 /application/MultiMC.cpp
parent71b129538be60615e69442a69e6737e0f346f7ab (diff)
downloadMultiMC-26f7f017d4bac569b62b9186d4ec5427ac755756.tar
MultiMC-26f7f017d4bac569b62b9186d4ec5427ac755756.tar.gz
MultiMC-26f7f017d4bac569b62b9186d4ec5427ac755756.tar.lz
MultiMC-26f7f017d4bac569b62b9186d4ec5427ac755756.tar.xz
MultiMC-26f7f017d4bac569b62b9186d4ec5427ac755756.zip
NOISSUE attept to detach from console on Windows
This only applies to MultiMC started from a console.
Diffstat (limited to 'application/MultiMC.cpp')
-rw-r--r--application/MultiMC.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index e94038ea..27ed04b5 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -816,18 +816,22 @@ void MultiMC::showFatalErrorMessage(const QString& title, const QString& content
MultiMC::~MultiMC()
{
+ // kill the other globals.
+ Env::dispose();
+
+ // Shut down logger by setting the logger function to nothing
+ qInstallMessageHandler(nullptr);
+
#if defined Q_OS_WIN32
- qDebug() << "In destructor!";
+ // Detach from Windows console
if(consoleAttached)
{
- const char * endline = "\n";
- auto out = GetStdHandle (STD_OUTPUT_HANDLE);
- DWORD written;
- WriteConsole(out, endline, strlen(endline), &written, NULL);
+ fclose(stdout);
+ fclose(stdin);
+ fclose(stderr);
+ FreeConsole();
}
#endif
- shutdownLogger();
- Env::dispose();
}
void MultiMC::messageReceived(const QString& message)
@@ -851,11 +855,6 @@ void MultiMC::messageReceived(const QString& message)
}
}
-void MultiMC::shutdownLogger()
-{
- qInstallMessageHandler(nullptr);
-}
-
void MultiMC::analyticsSettingChanged(const Setting&, QVariant value)
{
if(!m_analytics)