diff options
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r-- | src/ft_exit.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c index ca5201c..be4d46e 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -15,9 +15,9 @@ #include <mlx.h> #include <stddef.h> #include <stdlib.h> -#include <stdint.h> #include <signal.h> -#include <pthread.h> +#include <sys/wait.h> +#include <stdint.h> static void ft_free_lists(t_cub *clist) @@ -34,6 +34,7 @@ static void ft_memdel((void**)&clist->mlist.music_cmd); ft_memdel((void**)&clist->mlist.mapl); ft_free_words(clist->mlist.map); + ft_free_words(clist->mlist.mcmd_words); if (!clist->wlist.inited) ft_memdel((void**)&clist->wlist.winptr); } @@ -67,8 +68,8 @@ int } if (clist->isoldmus && clist->wlist.inited) { - pthread_cancel(clist->tid); - pthread_join(clist->tid, NULL); + kill(clist->mpid, SIGTERM); + wait(&clist->mpid); } ft_free_lists(clist); ft_printf("Exiting program\n"); |