I have a class derived from Fl_Double_Window.
That Fl_Double_Window has a Fl_Group that ends up holding an Fl_Text_Display.
The class also has a Fl_Text_Buffer associated with the Fl_Text_Display.
I am working on the destructor for my class.
If I call delete on the Fl_Text_Buffer, then the Buffer is destroyed before the Fl_Text_Display destructor gets called (through the Fl_Double_Window and Fl_Group destructors).
I've tried setting the Fl_Text_Display's buffer to NULL before destructing the buffer. This seems to 'work', but also seems extremely hacky.
Foo::~Foo() { m_Display->buffer( NULL ); delete m_Buffer;
}
Is this the proper way to clean up in this situation?
I might be able to make the Fl_Text_Buffer a direct member variable (instead of a pointer allocated with new), but I can still imagine situations where this would arise.
Am I missing something?
Rob
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/bd9a4810-5f42-4763-9a3e-56e3efef2984n%40googlegroups.com.
[ Direct Link to Message ] |