diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-30 13:21:53 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-30 13:21:53 -0500 |
commit | b35a780479bbf5038a825d415f9ca49c92f6b425 (patch) | |
tree | 44e71007552714b03ae812e466495ec5c8a7e27b /main.c | |
parent | a61d90c32d4d6448148894872ebd91eb8f10fc2e (diff) |
ctrl+q to quit (with unsaved changes dialog)
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ // @TODO: -// - when closing tabs/window, warn on unsaved changes +// - middle click to close tab // - try opening a file you don't have read permission for -- check for memory leaks! // - show something informative when there's no nodes open (i.e. ted->active_node == NULL). @@ -570,9 +570,11 @@ int main(int argc, char **argv) { SDL_DestroyWindow(window); SDL_Quit(); for (u16 i = 0; i < TED_MAX_BUFFERS; ++i) - buffer_free(&ted->buffers[i]); + if (ted->buffers_used[i]) + buffer_free(&ted->buffers[i]); for (u16 i = 0; i < TED_MAX_NODES; ++i) - node_free(&ted->nodes[i]); + if (ted->nodes_used[i]) + node_free(&ted->nodes[i]); buffer_free(&ted->line_buffer); text_font_free(ted->font); text_font_free(ted->font_bold); |