← Back to team overview

kicad-developers team mailing list archive

Re: Destroy a frame

 

Le 18/04/2015 21:13, Mário Luzeiro a écrit :
> Hello all,
> 
> I have a question regarding the following line 219 and 221
> 
> https://github.com/KiCad/kicad-source-mirror/blob/5f7268a17844068e9c2e96caf2f3771d29478754/3d-viewer/3d_frame.cpp#L219
> 
> 216	void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
> 217	{
> 218	    if( Parent() )
> 219	        Parent()->m_Draw3DFrame = NULL;
> 220	
> 221	    Destroy();
> 222	}
> 
> I am not sure how it works, I was expected somewhere a delete of m_Draw3DFrame  but there are none.
> 
> It can be created in some places like:
> https://github.com/KiCad/kicad-source-mirror/blob/086ff54ef099d959482d8b5565995c14e87ef6fa/pcbnew/footprint_wizard_frame.cpp#L536
> https://github.com/KiCad/kicad-source-mirror/blob/ec4d74c984e2037dd725a203864998775f0e084b/cvpcb/class_DisplayFootprintsFrame.cpp#L402
> https://github.com/KiCad/kicad-source-mirror/blob/f25f465d4c2488ade31206b02ebd06a092aa5fe8/pcbnew/modview_frame.cpp#L628
> https://github.com/KiCad/kicad-source-mirror/blob/7f1ea9e54d9b441b60b5ca0daa07a9d3f4c84653/pcbnew/moduleframe.cpp#L711
> https://github.com/KiCad/kicad-source-mirror/blob/be785d554b103fd268d07d0650622247b8349fdd/pcbnew/pcbframe.cpp#L656
> 
> Could someone explain if this is ok and how it works?

Destroy() is a call to wxWidgets to delete a window.
The delete is delayed by wxWidgets until all items depending on the
window are closed, dismissed or finished (pending events for instance)
and no Veto emitted by some child.


-- 
Jean-Pierre CHARRAS


References