From be577e6514b181c24c0eb0552e278bac2b0fe343 Mon Sep 17 00:00:00 2001 From: Ivan Zlatev Date: Sat, 1 Mar 2008 21:40:48 +0000 Subject: [PATCH] 2008-03-01 Ivan N. Zlatev * Component.cs: Do not set the Site to null on disposing as this is the Containers job. Instead try to remove from Container if sited. svn path=/trunk/mcs/; revision=97093 --- mcs/class/System/System.ComponentModel/ChangeLog | 5 +++++ mcs/class/System/System.ComponentModel/Component.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog index bc8e7ecb73be8..2162ffb883974 100644 --- a/mcs/class/System/System.ComponentModel/ChangeLog +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -1,3 +1,8 @@ +2008-03-01 Ivan N. Zlatev + + * Component.cs: Do not set the Site to null on disposing as this + is the Containers job. Instead try to remove from Container if sited. + 2008-02-26 Gert Driesen * CharConverter.cs: Use trimmed value in FormatException. diff --git a/mcs/class/System/System.ComponentModel/Component.cs b/mcs/class/System/System.ComponentModel/Component.cs index 8fcf61239ba80..5b095216aa822 100644 --- a/mcs/class/System/System.ComponentModel/Component.cs +++ b/mcs/class/System/System.ComponentModel/Component.cs @@ -131,11 +131,12 @@ public void Dispose () 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)