Commit f20f24cea3bf95e7808dabaccb0d8efcd25a7372

Thomas de Grivel 2023-12-13T02:21:42

make demo_asan

diff --git a/libc3/window/cairo/cairo_sprite.c b/libc3/window/cairo/cairo_sprite.c
index 505b1fa..581bb7f 100644
--- a/libc3/window/cairo/cairo_sprite.c
+++ b/libc3/window/cairo/cairo_sprite.c
@@ -27,11 +27,14 @@ void cairo_sprite_blit (const s_cairo_sprite *sprite, uw frame,
 
 void cairo_sprite_clean (s_cairo_sprite *sprite)
 {
+  void *data;
   uw i;
   assert(sprite);
   i = 0;
   while (i < sprite->frame_count) {
+    data = cairo_image_surface_get_data(sprite->surface[i]);
     cairo_surface_destroy(sprite->surface[i]);
+    free(data);
     i++;
   }
   free(sprite->surface);
diff --git a/libc3/window/sdl2/Makefile b/libc3/window/sdl2/Makefile
index 315d5ae..0d50f25 100644
--- a/libc3/window/sdl2/Makefile
+++ b/libc3/window/sdl2/Makefile
@@ -38,6 +38,12 @@ debug:
 demo: build
 	${MAKE} -C demo demo
 
+demo_asan: asan
+	${MAKE} -C demo demo_asan
+
+demo_cov: cov
+	${MAKE} -C demo demo_cov
+
 demo_debug: debug
 	${MAKE} -C demo demo_debug
 
@@ -75,11 +81,15 @@ update_sources:
 	cov \
 	debug \
 	demo \
+	demo_asan \
+	demo_cov \
+	demo_debug \
 	distclean \
 	gdb_demo \
 	install \
+	lldb_demo \
 	test \
-	update_sources
+	update_sources \
 
 include config.mk
 include sources.mk
diff --git a/libc3/window/sdl2/demo/Makefile b/libc3/window/sdl2/demo/Makefile
index ff2167c..4c7122f 100644
--- a/libc3/window/sdl2/demo/Makefile
+++ b/libc3/window/sdl2/demo/Makefile
@@ -52,6 +52,14 @@ demo:
 	${MAKE} ${PROG}
 	if ${HAVE_DARWIN}; then ${MAKE} -C macos demo; else time ./${PROG}; fi
 
+demo_asan:
+	${MAKE} asan
+	if ${HAVE_DARWIN}; then ${MAKE} -C macos demo_asan; else time ./${PROG_ASAN}; fi
+
+demo_cov:
+	${MAKE} cov
+	if ${HAVE_DARWIN}; then ${MAKE} -C macos demo_cov; else time ./${PROG_COV}; fi
+
 demo_debug:
 	${MAKE} debug
 	if ${HAVE_DARWIN}; then ${MAKE} -C macos demo_debug; else time ./${PROG_DEBUG}; fi
@@ -74,6 +82,9 @@ install:
 lldb_demo: debug
 	if ${HAVE_DARWIN}; then ${MAKE} -C macos lldb_demo; else lldb .libs/${PROG_DEBUG}; fi
 
+update_sources:
+	./update_sources
+
 .PHONY: \
 	all \
 	asan \
@@ -83,10 +94,14 @@ lldb_demo: debug
 	cov \
 	debug \
 	demo \
+	demo_asan \
+	demo_cov \
+	demo_debug \
 	distclean \
 	gdb_demo \
 	install \
-	lldb_demo
+	lldb_demo \
+	update_sources \
 
 include config.mk
 include sources.mk
diff --git a/libc3/window/window.c b/libc3/window/window.c
index b17178d..b4550dd 100644
--- a/libc3/window/window.c
+++ b/libc3/window/window.c
@@ -53,6 +53,7 @@ void window_clean (s_window *window)
   }
   free(window->sequence);
   tag_clean(&window->tag);
+  window->unload(window);
 }
 
 s_window * window_init (s_window *window,