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 16, 2023  
 
On 3/16/23 20:23 Rob McDonald wrote:
On Thursday, March 16, 2023 at 10:53:01 AM UTC-7 Albrecht Schlosser wrote:
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.


This fix works for me.

It took a while for me to figure out what he was doing -- it feels much more complex than a singly linked list should be.  It took even longer to convince myself that the fix is right.

Yes, I also had a hard time to find this out. I added a lot of debug statements in destructors to see when the first occurrence of the double free happened exactly. ASAN was a big help, but finally you need to understand what he was doing. I was surprised that he didn't include pointers in the objects but used the linked list

As you say -- it is hard to understand why the FLTK change would trigger this.

Yes, I have no idea, but I won't bother finding it out.


I also removed everything to do with previous -- it looks like a remnant of a doubly linked list, but it isn't used now.

Hmm, I'm not sure. In my version class 'Ca_ObjectChain' has only a 'next' and an 'object' pointer. The (local) variable 'previous' is AFAICT needed to close the linked list whenever you remove an entry from the middle of the list.

But maybe you meant something else...

--
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/5a64e85a-6abf-a3de-035a-5e54c4309d3a%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'.