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

Summary: Logging on Windows doesn't attach to console properly
Product: SDL Reporter: Sik <sik.the.hedgehog>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Windows (All)   

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.