Hi. I'm experiencing huge memory leaks when using popup menus. Generaly every 
popup of the menu takes about 200kb of memory more, I'm developing application 
which have a lot of menus, and this memory wasting is highly critical for me.

Here is small example which reproduces my problem, please check if I'm doing 
anything wrong.

[code]
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl.h>

void handle_menu(Fl_Widget*, void*)
{
   puts("menu handle called");
}

void cb(Fl_Widget*, void*)
{
   puts("window callback called");
   Fl_Menu_Item menu[] =
      {
         { "Action1", 0, handle_menu, NULL},
         { "Action2", 0, handle_menu, NULL},
         { "Action3", 0, handle_menu, NULL},
         { 0 }
      };
   const Fl_Menu_Item *m = menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, 0);
   if (m)
      m->do_callback(NULL, NULL);
}

int main(int argc, char **argv)
{
   Fl_Window window(140, 140);
   window.begin();
   Fl_Button but(20, 20, 100, 100, "push me");
   but.callback(cb);
   window.end();
   window.show();
   return Fl::run();
}
[/code]

Thanks in advance!
/*
 * gry
 */
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to