src/context.c

changeset 65
9c44c55d327a
parent 63
e3cacdd636e4
child 66
8297afa1c29c
     1.1 --- a/src/context.c	Thu Apr 18 21:53:53 2024 +0200
     1.2 +++ b/src/context.c	Thu Apr 18 22:53:55 2024 +0200
     1.3 @@ -47,6 +47,10 @@
     1.4          return;
     1.5      memset(&asc_context, 0, sizeof(AscContext));
     1.6  
     1.7 +    // nothing is active right after initialization
     1.8 +    asc_context.active_window = ASC_MAX_WINDOWS;
     1.9 +    asc_context.active_font = ASC_MAX_FONTS;
    1.10 +
    1.11      // initialize error buffer
    1.12      cxBufferInit(
    1.13              &asc_context.error_buffer,
    1.14 @@ -72,9 +76,9 @@
    1.15  
    1.16  void asc_context_destroy(void) {
    1.17      for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) {
    1.18 -        asc_window_destroy(&asc_context.windows[i]);
    1.19 +        asc_window_destroy(i);
    1.20      }
    1.21 -    asc_font_cache_clear();
    1.22 +    // TODO: fix that fonts are currently leaking by reworking the font cache
    1.23  
    1.24      // quit SDL
    1.25      if (TTF_WasInit())
    1.26 @@ -143,9 +147,7 @@
    1.27  
    1.28      // sync the windows
    1.29      for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) {
    1.30 -        if (asc_context.windows[i].id > 0) {
    1.31 -            asc_window_sync(&asc_context.windows[i]);
    1.32 -        }
    1.33 +        asc_window_sync(i);
    1.34      }
    1.35  
    1.36      // compute frame time

mercurial