FLTK logo

RE: [fltk.general] Re: Is FLTK performing automatic memory de-allocationof dynamically created objects?

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

RE: Re: Is FLTK performing automatic memory de-allocationof dynamically created objects? "'Philip Rose' via fltk.general" Sep 27, 2022  
 

 

 

Sent from Mail for Windows

 

From: Pierre Rouleau
Sent: 26 September 2022 13:38
To: fltk.general
Subject: [fltk.general] Re: Is FLTK performing automatic memory de-allocationof dynamically created objects?

 

On Monday, September 26, 2022 at 4:14:25 AM UTC-4 Manolo wrote:

Hi Pierre,

 

Hi Manolo, thanks for the answer.

 

One key information is that the destructor of an Fl_Group also deletes all the group's children :

 

Now, because FLTK widgets are placed in Fl_Window's and Fl_Window's are Fl_Group's,

when a window is deleted, all the widgets it contains are deleted too.

 

 

Ok, but if you have code that creates a pointer to a FL_button with new, like the following, don't you have to register that FL_Button somewhere so that it is know as a member?  Is the new operator overridden by FLTK?

 

        Fl_Button *fluidButton = new Fl_Button(25, 80, 70, 50, "button2"); 

 

/Pierre

 

 

Hi Pierre,

 

Yes, the constructor for the Fl_Group (or derivative) sets a (global?) current group pointer. The constructor for Fl_Widget then adds itself to an array within the current group. Also the group’s begin() will make that group the current group and its end() remove it. Hence you have to be careful with using end(). Forgetting it or calling it too many times can result in widgets going missing.

 

Phil.

--
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/a0b3b18f-5b2d-420b-a7de-c22308a5391en%40googlegroups.com.

 

--
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/6332e975.5d0a0220.5c087.06cfSMTPIN_ADDED_BROKEN%40gmr-mx.google.com.
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'.