Added memset() to Fl_Menu_::insert() after allocating and copying the

old menu data - otherwise new menu items could contain junk.


git-svn-id: file:///fltk/svn/fltk/trunk@364 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1999-03-04 18:43:04 +00:00
parent e9dd6127e2
commit 75964566a2

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_add.cxx,v 1.7 1999/02/03 08:43:33 bill Exp $"
// "$Id: Fl_Menu_add.cxx,v 1.8 1999/03/04 18:43:04 mike Exp $"
//
// Menu utilities for the Fast Light Tool Kit (FLTK).
//
@ -60,6 +60,7 @@ static Fl_Menu_Item* insert(
if (alloc && size >= INITIAL_MENU_SIZE && !((size+1)&size)) {
Fl_Menu_Item* newarray = new Fl_Menu_Item[(size+1)*2];
memcpy(newarray, array, (size+1)*sizeof(Fl_Menu_Item));
memset(newarray+size+1, 0, (size+1)*sizeof(Fl_Menu_Item));
delete[] array;
*alloc = array = newarray;
}
@ -196,5 +197,5 @@ void Fl_Menu_::remove(int i) {
}
//
// End of "$Id: Fl_Menu_add.cxx,v 1.7 1999/02/03 08:43:33 bill Exp $".
// End of "$Id: Fl_Menu_add.cxx,v 1.8 1999/03/04 18:43:04 mike Exp $".
//