X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.ComponentModel%2FComponent.cs;h=5c61d72eef89da05deee4e4ade0717818f8d4853;hb=d331ccd21f02cc156e5558ed407f6262ac4594f9;hp=e370a6aa6834ae328c4237904f1ffb104f5e3012;hpb=234225d112c4b018b8d1796f4c06a15812137500;p=mono.git diff --git a/mcs/class/System/System.ComponentModel/Component.cs b/mcs/class/System/System.ComponentModel/Component.cs index e370a6aa683..5c61d72eef8 100644 --- a/mcs/class/System/System.ComponentModel/Component.cs +++ b/mcs/class/System/System.ComponentModel/Component.cs @@ -32,10 +32,13 @@ using System; using System.ComponentModel; +using System.Runtime.InteropServices; namespace System.ComponentModel { [DesignerCategory ("Component")] + [ComVisible (true)] + [ClassInterface (ClassInterfaceType.AutoDispatch)] public class Component : MarshalByRefObject, IComponent, IDisposable { @@ -48,6 +51,17 @@ namespace System.ComponentModel { event_handlers = null; } + protected virtual bool CanRaiseEvents { + get { return false; } + } + + [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public virtual ISite Site + { + get { return mySite; } + set { mySite = value; } + } + [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public IContainer Container { get { @@ -81,22 +95,23 @@ namespace System.ComponentModel { } } - [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public virtual ISite Site { - get { return mySite; } - set { mySite = value; } - } - ~Component() { Dispose (false); } +#if TARGET_JVM + public virtual void Dispose () + { + Dispose (true); + } +#else public void Dispose () { Dispose (true); GC.SuppressFinalize (this); } +#endif // // Controls disposal of resources used by this. @@ -112,11 +127,12 @@ namespace System.ComponentModel { protected virtual void Dispose (bool release_all) { if (release_all) { + if (mySite != null && mySite.Container != null) + mySite.Container.Remove (this); EventHandler eh = (EventHandler) Events [disposedEvent]; if (eh != null) eh (this, EventArgs.Empty); } - mySite = null; } protected virtual object GetService (Type service)