diff --git a/ffi-cdecl/SDL2_0_decl.c b/ffi-cdecl/SDL2_0_decl.c index ccbbab293..a91356640 100644 --- a/ffi-cdecl/SDL2_0_decl.c +++ b/ffi-cdecl/SDL2_0_decl.c @@ -131,6 +131,7 @@ cdecl_func(SDL_EnableScreenSaver) cdecl_func(SDL_CreateWindow) cdecl_func(SDL_GetWindowSize) cdecl_func(SDL_CreateRenderer) +cdecl_func(SDL_DestroyRenderer) cdecl_func(SDL_CreateWindowAndRenderer) cdecl_func(SDL_GetRendererInfo) cdecl_func(SDL_GetRendererOutputSize) diff --git a/ffi/SDL2_0.lua b/ffi/SDL2_0.lua index 7a3b2feb7..77573bf9a 100644 --- a/ffi/SDL2_0.lua +++ b/ffi/SDL2_0.lua @@ -141,7 +141,7 @@ function S.open(w, h, x, y) -- What's even more curious is that we still only get a single SDL_WINDOWEVENT_MOVED on startup, except that way it's at the requested coordinates... SDL.SDL_SetWindowPosition(S.screen, pos_x, pos_y) - S.renderer = SDL.SDL_CreateRenderer(S.screen, -1, 0) + S.renderer = ffi.gc(SDL.SDL_CreateRenderer(S.screen, -1, 0), SDL.SDL_DestroyRenderer) local output_w = ffi.new("int[1]", 0) local output_h = ffi.new("int[1]", 0) if SDL.SDL_GetRendererOutputSize(S.renderer, output_w, output_h) == 0 and tonumber(output_w[0]) ~= w then diff --git a/ffi/SDL2_0_h.lua b/ffi/SDL2_0_h.lua index 943d8520b..aebf97741 100644 --- a/ffi/SDL2_0_h.lua +++ b/ffi/SDL2_0_h.lua @@ -794,6 +794,7 @@ void SDL_EnableScreenSaver(void) __attribute__((visibility("default"))); SDL_Window *SDL_CreateWindow(const char *, int, int, int, int, Uint32) __attribute__((visibility("default"))); void SDL_GetWindowSize(SDL_Window *, int *, int *) __attribute__((visibility("default"))); SDL_Renderer *SDL_CreateRenderer(SDL_Window *, int, Uint32) __attribute__((visibility("default"))); +void SDL_DestroyRenderer(SDL_Renderer *) __attribute__((visibility("default"))); int SDL_CreateWindowAndRenderer(int, int, Uint32, SDL_Window **, SDL_Renderer **) __attribute__((visibility("default"))); int SDL_GetRendererInfo(SDL_Renderer *, SDL_RendererInfo *) __attribute__((visibility("default"))); int SDL_GetRendererOutputSize(SDL_Renderer *, int *, int *) __attribute__((visibility("default")));