/** * Free data allocated by an rhash_t object * * @param ptr pointer to rhash_t object */ void rhash_destroy(struct rhash_t* ptr) { free_print_list(ptr->print_list); rsh_str_free(ptr->template_text); if(ptr->rctx) rhash_free(ptr->rctx); IF_WINDOWS(restore_console()); }
console_widget_NT_t::~console_widget_NT_t() { SetConsoleCtrlHandler(co_console_widget_control_handler, false); if (screen) co_os_free(screen); CloseHandle(buffer); SetConsoleCursorInfo(output, &cursor); restore_console(); }
/* A generic signal handler to ensure we don't quit in times of desperation, * risking corrupting the image. */ static void sig_hand(int sig) { restore_console(); printf("userui: Ack! SIG %d\n", sig); if (test_run) exit(1); if (!safe_to_exit) sleep(60*60*1); /* 1 hour */ _exit(1); }
/** * Exit the program, with restoring console state. * * @param code the program exit code */ void rhash_exit(int code) { IF_WINDOWS(restore_console()); exit(code); }