NOISSUE attept to detach from console on Windows
This only applies to MultiMC started from a console.
This commit is contained in:
		| @@ -816,18 +816,22 @@ void MultiMC::showFatalErrorMessage(const QString& title, const QString& content | |||||||
|  |  | ||||||
| MultiMC::~MultiMC() | 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 | #if defined Q_OS_WIN32 | ||||||
| 	qDebug() << "In destructor!"; | 	// Detach from Windows console | ||||||
| 	if(consoleAttached) | 	if(consoleAttached) | ||||||
| 	{ | 	{ | ||||||
| 		const char * endline = "\n"; | 		fclose(stdout); | ||||||
| 		auto out = GetStdHandle (STD_OUTPUT_HANDLE); | 		fclose(stdin); | ||||||
| 		DWORD written; | 		fclose(stderr); | ||||||
| 		WriteConsole(out, endline, strlen(endline), &written, NULL); | 		FreeConsole(); | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 	shutdownLogger(); |  | ||||||
| 	Env::dispose(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void MultiMC::messageReceived(const QString& message) | 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) | void MultiMC::analyticsSettingChanged(const Setting&, QVariant value) | ||||||
| { | { | ||||||
| 	if(!m_analytics) | 	if(!m_analytics) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Petr Mrázek
					Petr Mrázek