FLTK logo

~Fl_Window

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

~Fl_Window Anonymous May 02, 2006  
 
If you derive a class from Fl_Window are you supposed to do a hide() in the destructor?? I notice they did that in the editor program but I don't see it mentioned in the documentation.  Are there things that you must do or not do in the destructor?  The documentation for Fl_Double_Window::~Fl_Double_Window has two sentences that confuse me:

"The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. "

So if you do a "new Fl_Button" in a Fl_Double_Window derived constructor you don't have to do a delete for that button in the destructor??



My specific case:

I am trying to find out why I am getting intermittent core dumps when I go to delete a window (EditorWindow) that was copied from the editor.cxx example. It contains a pointer to a Fl_Window derived dialog window (CmdInsertWindow). In the Sun Solaris core dump call stack I see:

program terminated by signal ILL (illegal opcode)
0x004487b8: unimp 0x1c0

0x4487b8(0x4487c0, 0xf, 0x4322f0, 0xfee3c004, 0x0, 0x6) at 0x4487b7

Fl_Group::handle(0x448700, 0xf, 0x43e794, 0x6cc, 0x38, 0x4bab0), at 0x4c200

Fl_Window::hide(0x448700, 0x1, 0x41cb, 0xa93d4, 0xa9000, 0x448700) at 0x41e2c

Fl_Window::~Fl_Window(0x448700,0x44a840, 0x4489e0, 0x448a38) at 0x41e2c

CmdInsertWindow::~CmdInsertWindow(0x448700, 0x448a840, 0x4489e0, 0x448a38, 0x448380, 0x448988), at 0x2d400

EditorWindow::~EditorWindow(0x43aa98, 0xa, 0x0, 0xff056308, xff069e68, 0xa) at 0x30390

EditorWindow::CloseCallback(0x43aa98, 0x42ef178, 0x43aa98, 0x0, 0x21d30, 0x43aa98), at 0x32830

EditorWindow::close_cb(0x43aa98, 0-

Fl::handle(0x43aa98, 0x67800, 0x0, 0x43aa98, 0x325b8, 0x415d4) at 0x416cc

fl_handle(0xffbed1f0, 0-xffbed1f0, 0xffbed1f0, 0x43aa98, 0xae400, 0x6b650), at 0x6c594
do_queued_events(0xae800, 0xac000, 0xac32c, 0x1, 0x0, 0x1), at 0x6aad0
fl_wait(0x1, 0x6ae38, 0x8, 0x0, 0x10, 0xa9400), at 0x6ad58
Fl::wait(0x4415af1d, 0x78b58c40, 0x0, 0x40800, 0x0, 0xab478), at 0x40c48

Fl::run(0x431490, 0x1, 0xffbed7bc, 0x30c00, 0xae800, 0x43df8), at 0x40ca4

main(0x1, 0xffbed7bc, 0x42fe88, 0xa7400, 0x431490, 0x431700), at 0x37aa8

It's a little disturbing to see the hide() and handle() in the Fl_Window destructor. But maybe that is just to properly get rid of X Window System resources.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.