I am happy to read the many more options you have listed;
and to note the reactivity of the forum.
So many more subtleties to discover yet.
Thank you all and regards.
P.S: I'm not that unfamiliar to C++, just coming from other worlds
Le dimanche 27 septembre 2026 à 13:36:20 UTC+2, Daniel G. a écrit :
Hi,
in C++ if you create objects with the keyword 'new' you need to delete them yourself with 'delete'.
Please learn about RAII and Smart Pointers. Modern concepts which help you avoiding this problem.
nmse...@gmail.com schrieb am Sonntag, 27. September 2026 um 12:44:07 UTC+2:
Hello,
This is my very first step with FLTK and there are certainly many basic things I'm missing about this library.
My concern here is about object destruction.
The following mockup is created with FLUID. I have a added a destructor that is not called at all when the double window closes, with an exit code of 0. // --------------------------------------------------------------------------------------------------------------------- // cat blank.h // generated by Fast Light User Interface Designer (fluid) version 1.0405
class UserInterface { public: Fl_Double_Window* make_window();
// Testing destructor, not added by FLUID. virtual ~UserInterface(); }; #endif
// --------------------------------------------------------------------------------------------------------------------- // cat blank.cpp // generated by Fast Light User Interface Designer (fluid) version 1.0405
#include "blank.h"
Fl_Double_Window* UserInterface::make_window() { Fl_Double_Window* w; { Fl_Double_Window* o = new Fl_Double_Window(480, 320); w = o; (void)w; o->user_data((void*)(this)); o->end(); } // Fl_Double_Window* o fl_mkdir("/tmp/blank", S_IRUSR | S_IWUSR); return w; }
#include <iostream> UserInterface::~UserInterface() { // Does not get called! std::cout << __FUNCTION__ << std::endl; fl_rmdir("/tmp/blank"); } // --------------------------------------------------------------------------------------------------------------------- // cat main.cpp #include "blank.h"
int main(int argc, char * argv[]) { UserInterface * ui = new UserInterface(); Fl_Double_Window * cw = ui->make_window();
cw->show(); return Fl::run(); }
On application exit, nothing is printed in stdout and the created directory persists. I would have expected the contrary.
I wish to know what's going on, how far is it normal and what should I consider to resolve this.
Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.