One of the methods of „CControl“ like „removeDockable“ would be the closest thing to a dispose method.
Not having exception would probably be good too 
Could you please send me an entire xml file of a corrupted layout? It might give me more ideas on what could be going wrong (don’t get your hopes up).
As for fixing a layout. Just updating the xml is fine for me, but DockingFrames offers some methods to read and modify the file too. The example below only works with version 1.1.2_19d, which I uploaded a few minutes ago. (Yes, I did find a nasty bug when trying to write the example).
The application makes use of the „perspective“ API, which is just a wrapper around the content read from the XML file.
public static void main( String[] args ) throws IOException {
// buildFile();
EventQueue.invokeLater( () -> {
try {
// setup the CControl and other stuff
JFrame frame = new JFrame();
CControl control = new CControl( frame );
control.setMissingStrategy( MissingCDockableStrategy.STORE );
frame.add( control.getContentArea() );
DefaultSingleCDockable da = new DefaultSingleCDockable( "Aaa" );
control.addDockable( da );
DefaultSingleCDockable db = new DefaultSingleCDockable( "Bbb" );
control.addDockable( db );
DefaultSingleCDockable dc = new DefaultSingleCDockable( "Ccc" );
control.addDockable( dc );
// we read a corrupted layout from "test.xml" and write the cleaned version back to "out.xml"
try( FileReader in = new FileReader( new File( "test.xml" ) );
FileWriter out = new FileWriter( new File( "out.xml" ) ) ) {
XElement input = XIO.read( in );
// loading the data without affecting the CControl.
CControlPerspectiveBlop perspectives = control.getPerspectives().readAllXML( input );
// represents the layout that was shown when the file was stored
CPerspective perspective = perspectives.getPerspective();
// iterate over all elements, find the corrupted entries
Iterator<PerspectiveElement> elements = perspective.elements();
while( elements.hasNext() ) {
PerspectiveElement next = elements.next();
// all instances of DefaultDockablePerspective are corrupted entries
if( next instanceof DefaultDockablePerspective ) {
// removing them from their parent will delete them from the layout
DefaultDockablePerspective evil = (DefaultDockablePerspective) next;
evil.getParent().remove( evil );
}
}
// apply the fixed perspective
perspectives.setPerspective( perspective );
// write the settings back to some xml file
XElement output = new XElement( input.getName() );
perspectives.writeXML( output );
XIO.write( output, out );
}
frame.setBounds( 20, 20, 800, 800 );
frame.setVisible( true );
control.readXML( new File( "out.xml" ) );
// control.readXML( new File( "test.xml" ) );
} catch( IOException e ) {
throw new RuntimeException( e );
}
} );
}