Commit 318f961d authored by Morten Welinder's avatar Morten Welinder

Backport win32 crash on exit fix.

parent b1f5ac89
......@@ -343,12 +343,12 @@ main (int argc, char const *argv [])
gboolean has_console = FALSE;
{
typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD);
LPFNATTACHCONSOLE MyAttachConsole = NULL;
LPFNATTACHCONSOLE MyAttachConsole;
HMODULE hmod;
if ((hmod = GetModuleHandle("kernel32.dll"))) {
MyAttachConsole = (LPFNATTACHCONSOLE) GetProcAddress(hmod, "AttachConsole");
if (MyAttachConsole(ATTACH_PARENT_PROCESS)) {
if (MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
dup2(fileno(stdout), 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment