--- a/src/context.c Thu Apr 18 21:53:53 2024 +0200 +++ b/src/context.c Thu Apr 18 22:53:55 2024 +0200 @@ -47,6 +47,10 @@ return; memset(&asc_context, 0, sizeof(AscContext)); + // nothing is active right after initialization + asc_context.active_window = ASC_MAX_WINDOWS; + asc_context.active_font = ASC_MAX_FONTS; + // initialize error buffer cxBufferInit( &asc_context.error_buffer, @@ -72,9 +76,9 @@ void asc_context_destroy(void) { for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) { - asc_window_destroy(&asc_context.windows[i]); + asc_window_destroy(i); } - asc_font_cache_clear(); + // TODO: fix that fonts are currently leaking by reworking the font cache // quit SDL if (TTF_WasInit()) @@ -143,9 +147,7 @@ // sync the windows for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) { - if (asc_context.windows[i].id > 0) { - asc_window_sync(&asc_context.windows[i]); - } + asc_window_sync(i); } // compute frame time