This project is read-only.

[Version 1.3] DocumentContent.IsActiveDocument true on closing

Aug 19, 2010 at 3:27 PM
Edited Aug 19, 2010 at 3:29 PM
Hi there,

I"m using the latest 1.3 code in .NET 3.5. When a DocumentContent is opened, its IsActiveDocument property is set to True. Once it's closed, it's set to False but then back to True.
This seems to happen when I close the last DocumentContent inside a DocumentPane.
Is this a bug?

This is how I subscribe to the change event:
                        var isActiveDocumentProperty = DependencyPropertyDescriptor.FromProperty(ManagedContent.IsActiveDocumentProperty, typeof(DocumentContent));
                        isActiveDocumentProperty.AddValueChanged(newContent, OnIsActiveDocumentChanged);

And this is the stack trace at the moment when the property is wrongly set to True.


 	WindowsBase.dll!MS.Internal.ComponentModel.PropertyChangeTracker.OnPropertyInvalidation(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs args) + 0x3d bytes	
 	WindowsBase.dll!System.Windows.DependentList.InvalidateDependents(System.Windows.DependencyObject source = {MyNamespace.MyView}, System.Windows.DependencyPropertyChangedEventArgs sourceArgs) + 0x55 bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0x105 bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {IsActiveDocument}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, System.Windows.OperationType operationType) + 0x515 bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, System.Windows.OperationType operationType, bool isInternal) + 0x1eb bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyPropertyKey key, object value) + 0x39 bytes	
 	AvalonDock.dll!AvalonDock.ManagedContent.SetIsActiveDocument(bool value = true) Line 712 + 0x33 bytes	C#
 	AvalonDock.dll!AvalonDock.DockingManager.OnActiveDocumentChanged(System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 285 + 0xf bytes	C#
 	AvalonDock.dll!AvalonDock.DockingManager.OnActiveDocumentChanged(System.Windows.DependencyObject d = {AvalonDock.DockingManager}, System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 270 + 0x4d bytes	C#
 	WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x4a bytes	
 	PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x50 bytes	
 	AvalonDock.dll!AvalonDock.DockingManager.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 992 + 0x1f bytes	C#
 	WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0x2c bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {ActiveDocument}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, System.Windows.OperationType operationType) + 0x515 bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, System.Windows.OperationType operationType, bool isInternal) + 0x1eb bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x2e bytes	
 	AvalonDock.dll!AvalonDock.DockingManager.ActiveDocument.set(AvalonDock.ManagedContent value = {MyNamespace.MyView}) Line 262 + 0x12 bytes	C#
 	AvalonDock.dll!AvalonDock.DockingManager.OnActiveContentChanged(System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 392 + 0xb bytes	C#
 	AvalonDock.dll!AvalonDock.DockingManager.OnActiveContentChanged(System.Windows.DependencyObject d = {AvalonDock.DockingManager}, System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 373 + 0x4d bytes	C#
 	WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x4a bytes	
 	PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x50 bytes	
 	AvalonDock.dll!AvalonDock.DockingManager.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 992 + 0x1f bytes	C#
 	WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0x2c bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {ActiveContent}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, System.Windows.OperationType operationType) + 0x515 bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, System.Windows.OperationType operationType, bool isInternal) + 0x1eb bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x2e bytes	
 	AvalonDock.dll!AvalonDock.DockingManager.ActiveContent.set(AvalonDock.ManagedContent value = {MyNamespace.MyView}) Line 365 + 0x12 bytes	C#
 	AvalonDock.dll!AvalonDock.ManagedContent.Activate() Line 985 + 0x18 bytes	C#
 	AvalonDock.dll!AvalonDock.DocumentContent.Activate() Line 296 + 0x8 bytes	C#
 	AvalonDock.dll!AvalonDock.DockingManager.OnActiveDocumentChanged(System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 299 + 0xb bytes	C#
 	AvalonDock.dll!AvalonDock.DockingManager.OnActiveDocumentChanged(System.Windows.DependencyObject d = {AvalonDock.DockingManager}, System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 270 + 0x4d bytes	C#
 	WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x4a bytes	
 	PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x50 bytes	
 	AvalonDock.dll!AvalonDock.DockingManager.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 992 + 0x1f bytes	C#
 	WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0x2c bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex = {System.Windows.EntryIndex}, System.Windows.DependencyProperty dp = {ActiveDocument}, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, bool coerceWithDeferredReference, System.Windows.OperationType operationType) + 0x515 bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, System.Windows.OperationType operationType, bool isInternal) + 0x1eb bytes	
 	WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x2e bytes	
 	AvalonDock.dll!AvalonDock.DockingManager.ActiveDocument.set(AvalonDock.ManagedContent value = null) Line 262 + 0x12 bytes	C#
 	AvalonDock.dll!AvalonDock.DocumentContent.InternalClose() Line 351 + 0xc bytes	C#
 	AvalonDock.dll!AvalonDock.DocumentContent.Close() Line 407 + 0x8 bytes	C#
 	AvalonDock.dll!AvalonDock.ManagedContent.OnExecuteCommand(object sender = {MyNamespace.MyView}, System.Windows.Input.ExecutedRoutedEventArgs e = {System.Windows.Input.ExecutedRoutedEventArgs}) Line 880 + 0x11 bytes	C#
 	PresentationCore.dll!System.Windows.Input.CommandBinding.OnExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) + 0x63 bytes	
 	PresentationCore.dll!System.Windows.Input.CommandManager.ExecuteCommandBinding(object sender, System.Windows.Input.ExecutedRoutedEventArgs e = {System.Windows.Input.ExecutedRoutedEventArgs}, System.Windows.Input.CommandBinding commandBinding) + 0x97 bytes	
 	PresentationCore.dll!System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection commandBindings = {System.Windows.Input.CommandBindingCollection}, object sender = {MyNamespace.MyView}, System.Windows.RoutedEventArgs e = {System.Windows.Input.ExecutedRoutedEventArgs}, System.Windows.Input.ICommand command = {System.Windows.Input.RoutedUICommand}, bool execute = true) + 0x10b bytes	
 	PresentationCore.dll!System.Windows.Input.CommandManager.FindCommandBinding(object sender = {MyNamespace.MyView}, System.Windows.RoutedEventArgs e = {System.Windows.Input.ExecutedRoutedEventArgs}, System.Windows.Input.ICommand command = {System.Windows.Input.RoutedUICommand}, bool execute = true) + 0x15b bytes	
 	PresentationCore.dll!System.Windows.Input.CommandManager.OnExecuted(object sender = {MyNamespace.MyView}, System.Windows.Input.ExecutedRoutedEventArgs e = {System.Windows.Input.ExecutedRoutedEventArgs}) + 0x26 bytes	
 	PresentationCore.dll!System.Windows.UIElement.OnExecutedThunk(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) + 0x44 bytes	
 	PresentationCore.dll!System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(System.Delegate genericHandler, object target) + 0x3e bytes	
 	PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes	
 	PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes	
 	PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {MyNamespace.MyView}, System.Windows.RoutedEventArgs args = {System.Windows.Input.ExecutedRoutedEventArgs}, bool reRaised = false) + 0x1bf bytes	
 	PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {MyNamespace.MyView}, System.Windows.RoutedEventArgs args = {System.Windows.Input.ExecutedRoutedEventArgs}) + 0x79 bytes	
 	PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args = {System.Windows.Input.ExecutedRoutedEventArgs}, bool trusted) + 0x35 bytes	
 	PresentationCore.dll!System.Windows.Input.RoutedCommand.ExecuteImpl(object parameter, System.Windows.IInputElement target, bool userInitiated) + 0x11a bytes	
 	PresentationCore.dll!System.Windows.Input.RoutedCommand.ExecuteCore(object parameter, System.Windows.IInputElement target, bool userInitiated) + 0x48 bytes	
 	PresentationFramework.dll!MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource commandSource, bool userInitiated) + 0x79 bytes	
 	PresentationFramework.dll!System.Windows.Controls.Primitives.ButtonBase.OnClick() + 0x44 bytes	
 	PresentationFramework.dll!System.Windows.Controls.Button.OnClick() + 0x53 bytes	
 	PresentationFramework.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e) + 0x7a bytes	
 	PresentationCore.dll!System.Windows.UIElement.OnMouseLeftButtonUpThunk(object sender, System.Windows.Input.MouseButtonEventArgs e) + 0x57 bytes	
 	PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes	
 	PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes	
 	PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes	
 	PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {System.Windows.Controls.Button}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool reRaised = true) + 0x1bf bytes	
 	PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender = {System.Windows.Controls.Button}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, System.Windows.RoutedEvent newEvent) + 0x10a bytes	
 	PresentationCore.dll!System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(System.Windows.DependencyObject sender, System.Windows.Input.MouseButtonEventArgs e) + 0x2e bytes	
 	PresentationCore.dll!System.Windows.UIElement.OnMouseUpThunk(object sender, System.Windows.Input.MouseButtonEventArgs e) + 0xba bytes	
 	PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes	
 	PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes	
 	PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes	
 	PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {System.Windows.Controls.Button}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool reRaised = false) + 0x1bf bytes	
 	PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {System.Windows.Controls.Button}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}) + 0x79 bytes	
 	PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool trusted) + 0x35 bytes	
 	PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x311 bytes	
 	PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x42 bytes	
 	PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) + 0x62 bytes	
 	PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) + 0x2e2 bytes	
 	PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd = 2364044, int msg = 514, System.IntPtr wParam = 0, System.IntPtr lParam = 11535358, ref bool handled = false) + 0x523 bytes	
 	PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd = 2364044, int msg = 514, System.IntPtr wParam = 0, System.IntPtr lParam = 11535358, ref bool handled = false) + 0x75 bytes	
 	WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 2364044, int msg = 514, System.IntPtr wParam = 0, System.IntPtr lParam = 11535358, ref bool handled = false) + 0xbe bytes	
 	WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x7a bytes	
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = {System.Object DispatcherCallbackOperation(System.Object)}}, object args = {MS.Win32.HwndSubclass.DispatcherOperationCallbackParameter}, bool isSingleParameter = true) + 0x8a bytes	
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x4a bytes	
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x44 bytes	
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x91 bytes	
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x40 bytes	
 	WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 2364044, int msg = 514, System.IntPtr wParam = 0, System.IntPtr lParam = 11535358) + 0xdc bytes	
 	[Native to Managed Transition]	
 	[Managed to Native Transition]	
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0xc7 bytes	
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes	
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4c bytes	
 	PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x1e bytes	
 	PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes	
 	PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes	
 	PresentationFramework.dll!System.Windows.Application.Run() + 0x19 bytes	
 	MyShell.exe!MyShell.App.Main() + 0x5e bytes	C#
 	[Native to Managed Transition]	
 	[Managed to Native Transition]	
 	mscorlib.dll!System.AppDomain.nExecuteAssembly(System.Reflection.Assembly assembly, string[] args) + 0x19 bytes	
 	mscorlib.dll!System.Runtime.Hosting.ManifestRunner.Run(bool checkAptModel) + 0x6e bytes	
 	mscorlib.dll!System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() + 0x84 bytes	
 	mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext, string[] activationCustomData) + 0x65 bytes	
 	mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext) + 0xa bytes	
 	mscorlib.dll!System.Activator.CreateInstance(System.ActivationContext activationContext) + 0x3e bytes	
 	Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() + 0x23 bytes	
 	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes	
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes	
 	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes	
Mar 2, 2011 at 10:29 AM

Yes, I think that is a bug. When the last document is closed ActiveDocument property should have value == null, but it doesn't.

The solution is in the method InternalClose of DocumentContent

internal void InternalClose()
        {
            DockingManager manager = Manager;

			#region Customization
			// this fixes a bug when the last document is closed ActiveDocument property has value != null
			/*if (manager != null)
            {
                if (manager.ActiveContent == this)
                    manager.ActiveContent = null;

                if (manager.ActiveDocument == this)
                    manager.ActiveDocument = null;
            }           */
			#endregion

			DocumentPane parentPane = ContainerPane as DocumentPane;
            FloatingDocumentPane floatingParentPane = ContainerPane as FloatingDocumentPane;

            if (floatingParentPane != null)
            {
                floatingParentPane.RemoveContent(0);
                if (floatingParentPane.FloatingWindow != null &&
                    !floatingParentPane.FloatingWindow.IsClosing)
                    floatingParentPane.FloatingWindow.Close();
            }
            else if (parentPane != null)
            {
                parentPane.Items.Remove(this);

                parentPane.CheckContentsEmpty();
			}
			#region Customization
			// this fixes a bug when the last document is closed ActiveDocument property has value != null
			if (manager != null)
			{
				if (manager.ActiveContent == this)
					manager.ActiveContent = null;

				if (manager.ActiveDocument == this)
					manager.ActiveDocument = null;
			}
			#endregion
		}

Hope this helps.

Cheers.