From 1046cf2fb82f58eb06c9a9d89a8cb0119f18ec2b Mon Sep 17 00:00:00 2001 From: Callum McIntyre Date: Thu, 24 Nov 2016 16:51:48 +0000 Subject: [PATCH] [CA-232963] XC hangs after restarting toolstack while viewing PVS tab Changed the collection handlers to use ProgramInvokeHandler in the same way as other tabs, instead of Program.Invoke which caused the hang. --- XenAdmin/TabPages/PvsPage.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/XenAdmin/TabPages/PvsPage.cs b/XenAdmin/TabPages/PvsPage.cs index 7ec33b30e..780662ffc 100644 --- a/XenAdmin/TabPages/PvsPage.cs +++ b/XenAdmin/TabPages/PvsPage.cs @@ -49,6 +49,8 @@ namespace XenAdmin.TabPages private SelectionManager disableSelectionManager; private DataGridViewVms_DefaultSort vmDefaultSort; + + private readonly CollectionChangeEventHandler PvsProxy_CollectionChangedWithInvoke; public PvsPage() { @@ -61,7 +63,9 @@ namespace XenAdmin.TabPages disableSelectionManager = new SelectionManager(); vmDefaultSort = new DataGridViewVms_DefaultSort(); - + + PvsProxy_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(PvsProxyCollectionChanged); + base.Text = Messages.PVS_TAB_TITLE; } @@ -75,16 +79,16 @@ namespace XenAdmin.TabPages { if (connection != null) { - connection.Cache.DeregisterCollectionChanged(PvsProxyCollectionChanged); - connection.Cache.DeregisterCollectionChanged(PvsProxyCollectionChanged); + connection.Cache.DeregisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); + connection.Cache.DeregisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); } connection = value; if (connection != null) { - connection.Cache.RegisterCollectionChanged(PvsProxyCollectionChanged); - connection.Cache.RegisterCollectionChanged(PvsProxyCollectionChanged); + connection.Cache.RegisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); + connection.Cache.RegisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); } LoadVMs(); @@ -283,7 +287,7 @@ namespace XenAdmin.TabPages private void PvsProxyCollectionChanged(object sender, CollectionChangeEventArgs e) { - Program.Invoke(this, LoadVMs); + LoadVMs(); } private void VmPropertyChanged(object sender, PropertyChangedEventArgs e)