Fixed the gfx memory leak
This commit is contained in:
parent
1f27d6f923
commit
a788ac871b
13
src/main.c
13
src/main.c
|
@ -80,6 +80,14 @@ static void get_exe_filename(char *buf, int sz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void clearQuit(void)
|
||||||
|
{
|
||||||
|
rencache_invalidate();
|
||||||
|
ren_free_window_resources();
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init_window_icon(void) {
|
static void init_window_icon(void) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include "../icon.inl"
|
#include "../icon.inl"
|
||||||
|
@ -121,7 +129,7 @@ int main(int argc, char **argv) {
|
||||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
||||||
SDL_EnableScreenSaver();
|
SDL_EnableScreenSaver();
|
||||||
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
||||||
atexit(SDL_Quit);
|
atexit(clearQuit);
|
||||||
|
|
||||||
#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* Available since 2.0.8 */
|
#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* Available since 2.0.8 */
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
|
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
|
||||||
|
@ -158,7 +166,6 @@ init_lua:
|
||||||
|
|
||||||
lua_pushnumber(L, get_scale());
|
lua_pushnumber(L, get_scale());
|
||||||
lua_setglobal(L, "SCALE");
|
lua_setglobal(L, "SCALE");
|
||||||
|
|
||||||
char exename[2048];
|
char exename[2048];
|
||||||
get_exe_filename(exename, sizeof(exename));
|
get_exe_filename(exename, sizeof(exename));
|
||||||
lua_pushstring(L, exename);
|
lua_pushstring(L, exename);
|
||||||
|
@ -168,7 +175,6 @@ init_lua:
|
||||||
set_macos_bundle_resources(L);
|
set_macos_bundle_resources(L);
|
||||||
enable_momentum_scroll();
|
enable_momentum_scroll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *init_lite_code = \
|
const char *init_lite_code = \
|
||||||
"local core\n"
|
"local core\n"
|
||||||
"xpcall(function()\n"
|
"xpcall(function()\n"
|
||||||
|
@ -213,7 +219,6 @@ init_lua:
|
||||||
rencache_invalidate();
|
rencache_invalidate();
|
||||||
goto init_lua;
|
goto init_lua;
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_close(L);
|
lua_close(L);
|
||||||
ren_free_window_resources();
|
ren_free_window_resources();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
Loading…
Reference in New Issue