diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-02 16:49:58 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-02 16:49:58 +0100 |
commit | 488fcca09d46931a3ad4920cfe32d0581cfae027 (patch) | |
tree | af295d186c5c8e8dc2e9d4ba67903c7f55d0941d | |
parent | Music no leak (diff) | |
download | 42-cub3d-488fcca09d46931a3ad4920cfe32d0581cfae027.tar.gz 42-cub3d-488fcca09d46931a3ad4920cfe32d0581cfae027.tar.bz2 42-cub3d-488fcca09d46931a3ad4920cfe32d0581cfae027.tar.xz 42-cub3d-488fcca09d46931a3ad4920cfe32d0581cfae027.tar.zst 42-cub3d-488fcca09d46931a3ad4920cfe32d0581cfae027.zip |
Multilvl image leaks, rest is okok
-rw-r--r-- | map/lvl_one.cub | 4 | ||||
-rw-r--r-- | src/ft_exit.c | 13 | ||||
-rw-r--r-- | src/ft_music.c | 5 | ||||
-rw-r--r-- | src/ft_treat_args.c | 2 | ||||
-rw-r--r-- | src/ft_warp_level.c | 2 |
5 files changed, 7 insertions, 19 deletions
diff --git a/map/lvl_one.cub b/map/lvl_one.cub index 0151dc4..ae0f78c 100644 --- a/map/lvl_one.cub +++ b/map/lvl_one.cub @@ -15,8 +15,8 @@ LT ./media/img/crapaud.xpm MU ./media/sound/DEVANT-LES-KAISSONS.wav 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 L 0 0 0 0 1 +1 1 1 1 1 1 1 1 1 1 1 1 L 0 0 0 W 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 -1 E 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/src/ft_exit.c b/src/ft_exit.c index 40860e7..a19bff3 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -43,9 +43,6 @@ static void int ft_exit(uint8_t exit_code, t_cub *clist) { - uint8_t ismus; - pthread_t ttid; - if (clist->walltexgood) { if (clist->tlist[0].img) @@ -66,14 +63,12 @@ int mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); clist->wlist->winptr = NULL; } - ismus = clist->mlist->ismusic; - ttid = clist->tid; - ft_free_lists(clist); - if (ismus) + if (clist->mlist->ismusic) { - pthread_cancel(ttid); - pthread_join(ttid, NULL); + pthread_cancel(clist->tid); + pthread_join(clist->tid, NULL); } + ft_free_lists(clist); ft_printf("Exiting program\n"); exit(exit_code); return (0); diff --git a/src/ft_music.c b/src/ft_music.c index 8006928..5eed915 100644 --- a/src/ft_music.c +++ b/src/ft_music.c @@ -26,8 +26,3 @@ void system(cl->mlist->music_cmd); return (NULL); } - -/* void */ -/* *ft_hooks_thread(void *vargp) */ -/* { */ -/* } */ diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c index dab29ac..6f8ef87 100644 --- a/src/ft_treat_args.c +++ b/src/ft_treat_args.c @@ -38,9 +38,7 @@ uint8_t return (ft_exit(FT_RET_FAILED_MLX, clist)); ft_draw_scene(clist); if (clist->mlist->ismusic) - { pthread_create(&clist->tid, NULL, ft_music_thread, clist); - } ft_hooks_and_loops(clist->wlist, clist); } else if (argc == 3 && !ft_strncmp("--save", argv[2], 7)) diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index 866bd69..41d1a45 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -62,7 +62,7 @@ static void if (cl->mlist->ismusic) { pthread_cancel(cl->tid); - pthread_exit(NULL); + pthread_join(cl->tid, NULL); } } |