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 1605 - SDL_DestroyWindow causes erroneous error message
Summary: SDL_DestroyWindow causes erroneous error message
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-21 00:58 UTC by matto
Modified: 2012-09-28 04:03 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 matto 2012-09-21 00:58:09 UTC
In SDL_DestroyWindow, there is a conditional call to SDL_GL_MakeCurrent(NULL,NULL). This function has within it the CHECK_WINDOW_MAGIC macro, which outputs the error "Invalid window" and returns if the "window" parameter to the macro is null. While writing an application, I found that my code continuously output this error, but nothing would go wrong.
I am using XUbuntu 12.04 and Ubuntu 12.04. I don't know enough to tell whether the function is wrong or the function call is wrong, but the behaviour is wrong (the error output without any real error occurring). 
This is on the HG 2.0 repo, updated a couple of hours ago.

I'm pretty sure this happens whenever I make the following call:
SDL_Init(SDL_INIT_VIDEO)

The stack trace would look something like this:

SDL_Init(SDL_INIT_VIDEO);
SDL_InitSubsystem(SDL_INIT_VIDEO);
SDL_VideoInit(NULL);
ShouldUseTextureFramebuffer();
SDL_GL_MakeCurrent(NULL,NULL);
CHECK_WINDOW_MAGIC
Error is created

If the CHECK_WINDOW_MAGIC is simply removed, it results in a Seg Fault. I figure that the MakeCurrent function has to be modified to work properly with NULL values, but I'm not sure about that.
Comment 1 Sam Lantinga 2012-09-28 04:03:38 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/d7cb947898d7