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 1792

Summary: SDL prints ERROR: wglMakeCurrent(): The handle is invalid. on exit
Product: SDL Reporter: Wouter van Oortmerssen <aardappel>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P1 CC: icculus
Version: HG 2.0Keywords: target-2.0.0
Hardware: x86   
OS: Windows 7   
Attachments: proposed patch
proposed patch

Description Wouter van Oortmerssen 2013-04-06 20:37:48 UTC
if (_sdl_context) /*SDL_GL_DeleteContext(_sdl_context);*/ _sdl_context = NULL; 
    if (_sdl_window)  SDL_DestroyWindow(_sdl_window);     _sdl_window = NULL;

With the above delete context not commented out, SDL gives ERROR: wglMakeCurrent(): The handle is invalid.
Comment 1 Marcel Bakker 2013-04-07 07:36:14 UTC
Created attachment 1104 [details]
proposed patch

I ran across this problem also when trying to find a solution for : http://bugzilla.libsdl.org/show_bug.cgi?id=1775

the problem here is :
wglMakeCurrent( NULL, NULL), does NOT work for all video cards/drivers, when a HDC is given, the error disappears.
see google for : wglMakeCurrent ERROR_INVALID_HANDLE

note : i did not test this patch on other platforms
Comment 2 Marcel Bakker 2013-04-07 10:22:49 UTC
Created attachment 1105 [details]
proposed patch

Whoops, forgot to include some changes i made
Comment 3 Ryan C. Gordon 2013-07-12 18:52:46 UTC
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.0, Priority 1.

This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.
Comment 4 Ryan C. Gordon 2013-07-31 11:08:45 UTC
I took a different approach...should be fixed now in http://hg.libsdl.org/SDL/rev/f0091f8eae33

--ryan.