tech-userlevel archive

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

Re: curses: wmove(window, ...) doesn't set physical cursor



In article <1507925951.56433.1479909932210.JavaMail.ngmail%webmail12.arcor-online.net@localhost>,
Carsten Kunze  <carsten.kunze%arcor.de@localhost> wrote:
>Brett Lymn <blymn%internode.on.net@localhost> wrote:
>
>> On Mon, Nov 21, 2016 at 10:46:50PM +0100, Carsten Kunze wrote:
>> > 
>> > I want to do further tests with new hints I got from Brett.  If it doesn't
>> work I'll try again to prepare a minimum example from scratch.
>> > 
>> 
>> Just for the record, what I suggested was try a touchwin() or touch on
>> the subwin lines in the parent window before doing the refresh on the
>> parent.  The subtlety with using subwin() is that the child window
>> shares the data structures with the parent but updates on the subwin
>> don't mark the parent lines for update.  This sounds a bit
>> counterintuitive but I think this was a deliberate ploy to push the
>> logic of overlapping window refresh back to the application instead of
>> building it into the library.
>
>I did use subwin() to save some bytes of memory since I don't use
>stdscr directly.  If I now have to use additional touchwin() subwin()
>has performance drawbacks for me.  It is fine how it is implemented
>on NetBSD, but for my use case newwin() is now better suited.
>
>So I changed all subwin() to newwin(), now the situation is the other
>way round:  First tests don't show any curses issue, but now ncurses
>is unusable if wide char text is displayed (but ncurses works fine on
>OpenBSD and FreeBSD).  This is OT here and would be a topic for the
>pkgsrc list of course.
>
>But there is still one general issue with curses:
>
>When I use option -fsanitize=address with gcc (nb1 20160606) 5.4.0
>a curses program crashes with heap-buffer-overflow.
>
>This time I have a small test case:
>
>Makefile:
>
>LDADD=          -lcurses
>
>a.out: main.o
>        $(CC) -fsanitize=address main.o $(LDADD)
>
>clean:
>        rm -f main.o a.out
>
>.c.o:
>        $(CC) -c $(CFLAGS) -fsanitize=address $<
>
>main.c:
>
>#include <curses.h>
>
>int
>main()
>{
>        initscr();
>        endwin();
>        return 0;
>}

I used this as the Makefile, and I can't reproduce it (current/amd64)

$ cat Makefile 
LDFLAGS=-lcurses
CFLAGS=-g -fsanitize=address

all: main

clean:
        rm -f main




Home | Main Index | Thread Index | Old Index