diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_warp_level.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index 808b346..37789a5 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -15,13 +15,15 @@ #include <stdlib.h> #include <stddef.h> #include <stdint.h> -#include <mlx.h> +#include <unistd.h> #include <signal.h> -#include <pthread.h> +#include <sys/wait.h> +#include <mlx.h> static void ft_del_map(t_map *ml) { + ft_memdel((void**)&ml->filename); ft_memdel((void**)&ml->no_tex_path); ft_memdel((void**)&ml->so_tex_path); ft_memdel((void**)&ml->ea_tex_path); @@ -33,6 +35,7 @@ static void ft_memdel((void**)&ml->music_cmd); ft_memdel((void**)&ml->mapl); ft_free_words(ml->map); + ft_free_words(ml->mcmd_words); } static void @@ -66,16 +69,16 @@ static void { if (isoldmus && !cl->mlist.ismusic) { - pthread_cancel(cl->tid); - pthread_join(cl->tid, NULL); + kill(cl->mpid, SIGTERM); + wait(&cl->mpid); cl->isoldmus = 0; } else if (isoldmus && cl->mlist.ismusic && ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1)) { - pthread_cancel(cl->tid); - pthread_join(cl->tid, NULL); - pthread_create(&cl->tid, NULL, ft_music_thread, cl); + kill(cl->mpid, SIGTERM); + wait(&cl->mpid); + ft_enable_music(cl); } else if (isoldmus && cl->mlist.ismusic && !ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1)) |