NCursesMenu help

View: New views
2 Messages — Rating Filter:   Alert me  

NCursesMenu help

by meehand :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys,

I'm currently constructing a user interface using the Ncurses C++ classes,
but appear to have hit a bit of a problem. Whenever I attempt to create
an instance of the NCursesMenu class, construction fails and the program
segfaults. This only appears to manifest whenever the previously constructed
NCursesMenuItem objects are initialized with a non-null p_name parameter.
I'm not sure if I'm using the class improperly (given the lack of documentation
on the use of the Ncurses C++ classes), or if something else is at play - I'm
compiling against the stock 5.6 release. Please find attached a quick code
example. Any help you can provide is greatly appreciated.
test.cpp

Regards,
David.

Re: NCursesMenu help

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 28 Jul 2008, meehand wrote:

>
> Hi guys,
>
> I'm currently constructing a user interface using the Ncurses C++ classes,
> but appear to have hit a bit of a problem. Whenever I attempt to create
> an instance of the NCursesMenu class, construction fails and the program
> segfaults. This only appears to manifest whenever the previously constructed
> NCursesMenuItem objects are initialized with a non-null p_name parameter.
> I'm not sure if I'm using the class improperly (given the lack of
> documentation
> on the use of the Ncurses C++ classes), or if something else is at play -
> I'm
> compiling against the stock 5.6 release. Please find attached a quick code
> example. Any help you can provide is greatly appreciated.
> http://www.nabble.com/file/p18690268/test.cpp test.cpp

valgrind says (will check to see who's at fault):

==12861== Invalid read of size 4
==12861==    at 0x804B26E: NCursesMenu::mapItems(NCursesMenuItem**) (cursesm.cc:104)
==12861==    by 0x804C43C: NCursesMenu::InitMenu(NCursesMenuItem**, bool, bool)(cursesm.cc:135)
==12861==    by 0x804AA06: Interface::run() (cursesm.h:311)
==12861==    by 0x804EEC8: NCursesApplication::operator()() (cursesapp.cc:149)
==12861==    by 0x804F070: main (cursesmain.cc:74)
==12861==  Address 0x454f608 is 0 bytes after a block of size 8 alloc'd
==12861==    at 0x402309E: operator new[](unsigned) (vg_replace_malloc.c:268)
==12861==    by 0x804A8C7: Interface::run() (demo.cc:29)
==12861==    by 0x804EEC8: NCursesApplication::operator()() (cursesapp.cc:149)
==12861==    by 0x804F070: main (cursesmain.cc:74)
==12861==


--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses
LightInTheBox - Buy quality products at wholesale price!