FLTK logo

Re: [fltk.coredev] Double free of groups

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.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Double free of groups Albrecht Schlosser Mar 15, 2023  
 
Title: Re: [fltk.coredev] Double free of groups
On 3/15/23 15:12 Albrecht Schlosser wrote:
On 3/15/23 01:29 Rob McDonald wrote:
a09b0e2357f2  Remove reversal of children in Fl_Group::clear()  (Albrecht Schlosser)

Causes my program to attempt to double-free a widget on shutdown.
[...]
The particular group that is crashing ... includes widgets from Cartesian, a [...] 2D plotting library for FLTK developed by Roman Kantor.

OK, after a little research I found OpenVSP on GitHub (which appears to be the project you mentioned) and a newer version of the Cartesian library here: https://sourceforge.net/p/rfltk/code/HEAD/tree/cartesian/

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()`.

Source code: https://sourceforge.net/p/rfltk/code/HEAD/tree/cartesian/test/example.cpp

Modified like this (see comment):
```
Fl_Double_Window *w = new Fl_Double_Window(580, 380, "Cartesian graphics example");
// ... more code here ...
w->end();
w->show(argc, argv);
Fl::add_timeout(0, next_freq);
Fl::run();
delete w; // ADDED only this statement
return 0;
```

    
This is an example I can work with, and I'll investigate this issue. Please don't expect quick results though, today my time is very much limited. I hope I can find something more tomorrow.


Current status of investigation:

1. the modified Cartesian example crashes with double free when built with FLTK 1.4.0 (git)
2. it does not crash with FLTK 1.3.x (not sure which git commit exactly), i.e. it exits silently

Note that this doesn't mean (yet) that the program doesn't *attempt* a double free in FLTK 1.3. So far it only means that this is *not diagnosed* by my current build of 1.3.x. I'll need to use a memory checker to verify this and I need more time to debug it.

I'll let you know when I have more info.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/f3b95d50-a186-7cd6-f9e6-19ff7b6bdf39%40online.de.
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'.