Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_GL_UnbindTexture segfaults on osx #1269

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

SDL_GL_UnbindTexture segfaults on osx #1269

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Labels

Comments

@SDLBugzilla
Copy link
Collaborator

@SDLBugzilla SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.1
Reported for operating system, platform: Mac OS X 10.8, x86

Comments on the original bug report:

On 2013-12-11 13:10:05 +0000, Daniel Bünzli wrote:

The program at the end of the report segfaults on the call to SDL_GL_UnbindTexture().

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000034
0x000000010003c3ea in GL_UnbindTexture ()
(gdb) bt

0 0x000000010003c3ea in GL_UnbindTexture ()

1 0x0000000100000e29 in main ()

Looking at the code of SDL_GL_BindTexture(), I see there's a special path whenever texture->native is true that is not present in SDL_GL_UnbindTexture is that maybe the problem ?

Best,

Daniel

#include <unistd.h>
#include "SDL.h"
#include <assert.h>
int main(int argc, char** argv)
{
SDL_Init(SDL_INIT_VIDEO);

SDL_Window *w = SDL_CreateWindow
("SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
640, 480, SDL_WINDOW_OPENGL);
assert (w);

SDL_GLContext *c = SDL_GL_CreateContext(w);
assert (c);
SDL_GL_MakeCurrent(w,c);

SDL_Renderer *r = SDL_CreateRenderer(w, 0, 0);
assert (r);

SDL_Texture t = SDL_CreateTexture(r, SDL_PIXELFORMAT_RGBA8888,
SDL_TEXTUREACCESS_STATIC, 256, 256);
assert(t);
SDL_GL_BindTexture(t, NULL, NULL);
SDL_GL_UnbindTexture(t); /
BOOM */

SDL_DestroyTexture(t);
SDL_DestroyRenderer(r);
SDL_GL_DeleteContext(c);
SDL_DestroyWindow(w);
SDL_Quit();
return 0;
}

On 2014-02-24 21:58:03 +0000, Gabriel Jacobo wrote:

Fixed, thanks! https://hg.libsdl.org/SDL/rev/294f28074ecc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant