+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.ComponentModel/Component.cs:
+ * System.ComponentModel/ComponentCollection.cs:
+ * System.ComponentModel/Container.cs:
+ * System.ComponentModel/MarshalByValueComponent.cs:
+ * System.Diagnostics/Process.cs:
+ * System.Diagnostics/TextWriterTraceListener.cs:
+ * System.IO/FileSystemWatcher.cs:
+ IDisposable fixes.
+
2002-08-15 Tim Coleman <tim@timcoleman.com>
* list.unix: Added System.IO files.
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Component.cs:
+ * ComponentCollection.cs:
+ * Container.cs:
+ * MarshalByValueComponent.cs: IDisposable fixes.
+
2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* BindableSupport.cs:
EventHandlerList event_handlers;
ISite mySite;
+ object disposedEvent = new object ();
// <summary>
// Component Constructor
}
}
- [MonoTODO]
~Component()
{
- // FIXME: Not sure this is correct.
- Dispose(true);
+ Dispose (false);
}
// <summary>
// Dispose resources used by this component
// </summary>
- [MonoTODO]
public void Dispose ()
{
- // FIXME: Not sure this is correct.
- Dispose(false);
- if (Disposed != null)
- Disposed(this, EventArgs.Empty);
+ Dispose (true);
+ GC.SuppressFinalize (this);
}
// <summary>
// </remarks>
protected virtual void Dispose (bool release_all)
{
+ if (release_all) {
+ EventHandler eh = (EventHandler) Events [disposedEvent];
+ if (eh != null)
+ eh (this, EventArgs.Empty);
+ }
+ mySite = null;
}
// <summary>
return String.Format ("{0} [{1}]", mySite.Name, GetType ().ToString ());
}
// <summary>
- // FIXME: Figure out this one.
+ // This event is called when the component is explicitly disposed.
// </summary>
- [MonoTODO ("Figure this out")]
- public event EventHandler Disposed;
+ public event EventHandler Disposed
+ {
+ add {
+ Events.AddHandler (disposedEvent, value);
+ }
+ remove {
+ Events.RemoveHandler (disposedEvent, value);
+ }
+ }
}
}
throw new NotImplementedException ();
}
- [MonoTODO ("this probably shouldn't be here.")]
- public void Dispose ()
- {
- throw new NotImplementedException ();
- }
-
#endregion // Methods
}
{
if (disposed)
return;
+ disposed = true;
if (release_all){
- cc.Dispose ();
- cc = null;
+ //??
}
- disposed = true;
+ cc = null;
+ }
+
+ ~Container ()
+ {
+ Dispose (false);
}
[MonoTODO]
// but do not throw a NotImplementedException
}
- [MonoTODO]
- public void Dispose () {
- // TODO: need to do, but do not
- // throw a NotImplementedException
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
}
[MonoTODO]
- protected virtual void Dispose (bool disposing) {
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing) {
+ // free managed objects contained here
+ }
+
+ // Free unmanaged objects
+ // Set fields to null
}
+ ~MarshalByValueComponent ()
+ {
+ Dispose (false);
+ }
+
[MonoTODO]
public virtual object GetService (Type service) {
return null;
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Process.cs:
+ * TextWriterTraceListener.cs: IDisposable fixes.
+
2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Process.cs: class status based fixes.
protected override void Dispose(bool disposing) {
// Check to see if Dispose has already been called.
if(this.disposed) {
+ this.disposed=true;
// If this is a call to Dispose,
// dispose all managed resources.
if(disposing) {
}
// Release unmanaged resources
- this.disposed=true;
lock(this) {
if(process_handle!=IntPtr.Zero) {
}
}
}
- }
-
- public new void Dispose() {
- Dispose(true);
- // Take yourself off the Finalization queue
- GC.SuppressFinalize(this);
+ base.Dispose (disposing);
}
[MonoTODO]
{
if (disposing)
Close ();
+
+ base.Dispose (disposing);
}
public override void Flush ()
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileSystemWatcher.cs: IDisposable fixes.
+
2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* InternalBufferOverflowException.cs:
[MonoTODO]\r
protected override void Dispose (bool disposing)\r
{\r
- throw new NotImplementedException (); \r
+ if (disposing) {\r
+ // \r
+ }\r
+ base.Dispose (disposing);\r
}\r
\r
[MonoTODO]\r