bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unlock of an unlocked mutex


From: Thomas Dickey
Subject: Re: unlock of an unlocked mutex
Date: Sat, 9 Jul 2022 11:14:43 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Jul 07, 2022 at 06:01:37PM +0200, Tom de Vries wrote:
> Hi,
> 
> After building gdb with gcc -fsanitize=thread, I ran into a problem in
> ncurses.
> 
> It's easy to reproduce using this small program:
> ...
> $ cat test.c
> #include <stdlib.h>
> #include <stdio.h>
> #include <curses.h>
> 
> int
> main (void)
> {
>   newterm (NULL, stdout, stdin);
> 
>   return 0;
> }
...
> What happens is:
> - we lock the mutex
> - we init the mutex, which destroys the locked mutex, and creates an
>   unlocked one
> - we unlock the unlocked mutex
> 
> I wonder if this fixes it:

adding _nc_init_pthreads seems to help (though I see more work needed, since
there are similar cases, and _nc_init_pthreads itself doesn't use a mutex --
I'll work on that.

Oddly enough, most of the test-programs using newterm don't have a problem.

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]