X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=mcs%2Fclass%2FSystem%2FSystem.ComponentModel%2FComponent.cs;h=5c61d72eef89da05deee4e4ade0717818f8d4853;hb=d331ccd21f02cc156e5558ed407f6262ac4594f9;hp=fe90205480ecb4b9d1c95909a8de3d2769262978;hpb=669beaed8380fa592533c8755f72593b4422d01d;p=mono.git diff --git a/mcs/class/System/System.ComponentModel/Component.cs b/mcs/class/System/System.ComponentModel/Component.cs index fe90205480e..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,12 +95,6 @@ namespace System.ComponentModel { } } - [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public virtual ISite Site { - get { return mySite; } - set { mySite = value; } - } - ~Component() { Dispose (false); @@ -119,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)