Removed clearQuit() and applied commit 456f6ed changes to free the resources

This commit is contained in:
George Sokianos 2022-01-02 19:04:18 +00:00
parent b5d4f3f0f8
commit de3e4815ee
2 changed files with 5 additions and 12 deletions

View File

@ -512,6 +512,7 @@ function core.init()
core.redraw = true
core.visited_files = {}
core.restart_request = false
core.quite_request = false
core.replacements = whitespace_replacements()
core.root_view = RootView()
@ -668,7 +669,8 @@ local function quit_with_function(quit_fn, force)
end
function core.quit(force)
quit_with_function(os.exit, force)
-- quit_with_function(os.exit, force)
quit_with_function(function() core.quit_request = true end, force)
end
@ -1044,7 +1046,7 @@ function core.run()
core.frame_start = system.get_time()
local did_redraw = core.step()
local need_more_work = run_threads()
if core.restart_request then break end
if core.restart_request or core.quit_request then break end
if not did_redraw and not need_more_work then
idle_iterations = idle_iterations + 1
-- do not wait of events at idle_iterations = 1 to give a chance at core.step to run

View File

@ -79,15 +79,6 @@ static void get_exe_filename(char *buf, int sz) {
#endif
}
static void clearQuit(void)
{
rencache_invalidate();
ren_free_window_resources();
SDL_Quit();
}
static void init_window_icon(void) {
#ifndef _WIN32
#include "../icon.inl"
@ -129,7 +120,7 @@ int main(int argc, char **argv) {
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
SDL_EnableScreenSaver();
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
atexit(clearQuit);
atexit(SDL_Quit);
#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");