We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2778 - Logging on Windows doesn't attach to console properly
Summary: Logging on Windows doesn't attach to console properly
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All Windows (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-08 10:56 UTC by Sik
Modified: 2014-11-08 10:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sik 2014-11-08 10:56:51 UTC
Found first on SDL 2.0.3-9008 and verified on 2.0.4-9174. When SDL_LogOutput tries to attach itself to the console, it checks the return value of AttachConsole. The problem is that it checks for true as failure, when the function returns false as failure instead.

Suggested fix would be to change this line (335 of SDL_log.c in 2.0.4-9174):

    if (!attachResult) {

With this (just removed the ! essentially):

    if (attachResult) {

Would be nice if somebody can verify this first (I found the error in the code but I haven't been able to test it yet).
Comment 1 Sik 2014-11-08 10:58:18 UTC
Argh forget it, just realized I misread the line (why do I realize *only* when I click send when I looked at the code for like an hour? argh) Nevermind.