private void AccumulateDestroyedHandles (Control c, ArrayList list) {
if (c != null) {
Control[] controls = c.Controls.GetAllControls ();
if (c.IsHandleCreated && !c.IsDisposed) {
Hwnd hwnd = Hwnd.ObjectFromHandle(c.Handle);
list.Add (hwnd);
CleanupCachedWindows (hwnd);
}
for (int i = 0; i < controls.Length; i ++) {
AccumulateDestroyedHandles (controls[i], list);
}
}
}