[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

ncurses and menu



Hello,
I've been designing an editor. I've used the ncurses' menu library to do the interface. I've used rhide for an IDE. Heres the problem : The editor works fine without being run with any arguements. I am able to open most files including NFS-HOWTO..and most other large txt files.

However, if I specify, a text file as an arguement, and this file happens to exceed a page, the editor crashes with a segmentation fault.

On tracing the code, I tracked the problem down to a menu definition as shown below. This object, is totally unrelated to the file opened or the size or anything. The names variable has been assigned properly(global strings in a namespace). The size of sz has also been verified? Is this a bug with menu?

Rajeev

menuobj::menuobj(char **names, int sz, int begx,int begy,int n) : menuno(n)
{
   ITEM **p = new ITEM *[sz];
   for(int i = 0; i < sz; i++)
       p[i] = new_item(names[i],0);
=>    menu = new_menu(p); //line where error occurs
   int r,c; scale_menu(menu, &r,&c);
   menuwin = newwin(r+1,c+1,begx,begy);
   keypad(menuwin,1);
   set_menu_win(menu, menuwin);
   menu_opts_off(menu,O_NONCYCLIC);
   menu_opts_off(menu,O_SHOWDESC);
}






---------------------------------------------
Find out more about this and other Linux India
mailing lists at http://lists.linux-india.org/

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.