Meanwhile I also found out that this library adds more than one
FLTK widget to its parent group (or window) - which may cause the
double free under certain circumstances - and I could indeed make
the provided example program crash with double free if I only
delete the main window after `Fl::run()`.
See below, this was not the case, i.e. it was not FLTK's fault.
This is an example I can work with, and I'll investigate this
issue. ...
I'll let you know when I have more info.
I have good news: I found the culprit in the Cartesian software and
it is easy to fix. Fortunately it has nothing to do with the changes
in FLTK - at least as far as I could find out. I concentrated on
finding the bug and didn't investigate why the older FLTK version
did not exhibit the bug whereas the newer version does because this
is moot. A bug is a bug. ;-)
The double free bug is (potentially) caused by two identical
statements in `Ca_X_Axis::~Ca_X_Axis()`
and `Ca_Y_Axis::~Ca_Y_Axis()`. In my
tests it was only triggered by `~Ca_Y_Axis()`
but since both d'tors are structured identically I fixed both of
them in my version.
If you comment out the two statements as shown below in context
(marked with '<<<<<<<')
the bug should be gone. Hopefully.
Note that this doesn't fix all memory leaks in the demo program, but
neither valgrind nor ASAN report any errors after this fix.
Please let me know if this fixes the issue for you.
That said, I changed a lot more code in my version, fixed compiler
warnings, removed unused variables, and fixed usage of uninitialized
variables (!). I'm thinking about publishing my fixes somewhere,
maybe on GitHub, but this is not yet possible - it would need some
more work to clean up everything.
Rob, you wrote before that you also had to fix some issues. Can you
tell me what you fixed, and/or post a link to your fixed version of
the Cartesian library? Is it maybe included in your OpenVSP project?
If yes, I don't remember to have seen it (only a link to the
sourceforge repo, IIRC). I'd appreciate if we could synchronize our
efforts, but this is now probably OT here and we can check this
off-list if you agree. Let me know...
Back on topic:
My proposed changes: since I'm not sure that we are using the same
version of the Cartesian project, following is the full code of the
two mentioned d'tors with fixes.
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.