Fixed bug 1929 - SDL_Texture* from SDL_CreateTexture() causes GL_BindTexture() to segfault
Charles Huber If SDL_CreateTexture() takes the !IsSupportedFormat() path it will return a SDL_Texture* with a NULL driverdata member. If you then SDL_GL_BindTexture() this will cause a segfault in GL_BindTexture() when it unconditionally dereferences driverdata.
This commit is contained in:
parent
eb00bbd7f9
commit
86e40a29d3
1 changed files with 5 additions and 3 deletions
|
@ -1739,11 +1739,13 @@ int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)
|
||||||
|
|
||||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (renderer && renderer->GL_BindTexture) {
|
if (texture->native) {
|
||||||
|
return SDL_GL_BindTexture(texture->native, texw, texh);
|
||||||
|
} else if (renderer && renderer->GL_BindTexture) {
|
||||||
return renderer->GL_BindTexture(renderer, texture, texw, texh);
|
return renderer->GL_BindTexture(renderer, texture, texw, texh);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GL_UnbindTexture(SDL_Texture *texture)
|
int SDL_GL_UnbindTexture(SDL_Texture *texture)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue