summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-30 13:21:53 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-30 13:21:53 -0500
commitb35a780479bbf5038a825d415f9ca49c92f6b425 (patch)
tree44e71007552714b03ae812e466495ec5c8a7e27b /main.c
parenta61d90c32d4d6448148894872ebd91eb8f10fc2e (diff)
ctrl+q to quit (with unsaved changes dialog)
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.c b/main.c
index 8ef9aa2..1157ce4 100644
--- a/main.c
+++ b/main.c
@@ -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);