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

ncurses and menu

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?


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);
   set_menu_win(menu, menuwin);

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.