> MyWindow( int x, int y, int w, int h ) : Fl_Double_Window( x, y, w, h ) {
> fl_register_images(); //initialize image lib
> [..]
> Fl_PNG_Image png(
> "/home/maxmeier/projects/cpp/fltk/MyFltk/myfltk/close.png");
It's crashing because your instance of "Fl_PNG_Image png(..)"
is going out of scope by the end of your MyWindow constructor.
You need it's scope to last the lifetime of the window.
Use 'new' instead to create the instance of the Fl_PNG_Image,
similar to how you've done for the Fl_Box pBox.
Also, a suggestion:
Put fl_register_images() at the top of main(), not in the constructor,
to be sure it's called only once. (Your app could possibly make several
instances of MyWindow, which would call it several times).
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk