1
Vote

CompositeControlBase.Dispose(bool) prevents disposing children

description

if (controls != null) controls.Clear(); should occur after calling base.Dispose(dispose) because it backs up GetVisibleControls() which is used by base.Dispose(bool)
 
 
 
diff:

Index: C:/Work/Learn/Silvermoon/SilvermoonSvn/Silvermoon/Silvermoon/Controls/Base/CompositeControlBase.cs

--- C:/Work/Learn/Silvermoon/SilvermoonSvn/Silvermoon/Silvermoon/Controls/Base/CompositeControlBase.cs (revision 52428)
+++ C:/Work/Learn/Silvermoon/SilvermoonSvn/Silvermoon/Silvermoon/Controls/Base/CompositeControlBase.cs (working copy)
@@ -37,9 +37,11 @@
     #region dtor
     protected override void Dispose(bool dispose)
     {
  • base.Dispose(dispose);
  • if (controls != null) controls.Clear();
         styles = null;
    +
  • base.Dispose(dispose);
    +
  • if (controls != null) controls.Clear(); // remark: called after base.Dispose(dispose) because it backs up GetVisibleControls() which is used by base.Dispose(bool)
     }
     #endregion
     #region props

comments