Only reopen the streams if AllocConsole succeeds.
Avoid a crash with FGRun when OSG tries to use the console.
This commit is contained in:
@@ -232,13 +232,11 @@ public:
|
|||||||
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
|
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
|
||||||
// attach failed, don't install the callback
|
// attach failed, don't install the callback
|
||||||
addStderr = false;
|
addStderr = false;
|
||||||
}
|
} else if (!isFile) {
|
||||||
|
// No - OK! now set streams to attached console
|
||||||
if (!isFile) {
|
freopen("conout$", "w", stdout);
|
||||||
// No - OK! now set streams to attached console
|
freopen("conout$", "w", stderr);
|
||||||
freopen("conout$", "w", stdout);
|
}
|
||||||
freopen("conout$", "w", stderr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (addStderr) {
|
if (addStderr) {
|
||||||
m_callbacks.push_back(new StderrLogCallback(m_logClass, m_logPriority));
|
m_callbacks.push_back(new StderrLogCallback(m_logClass, m_logPriority));
|
||||||
|
|||||||
Reference in New Issue
Block a user