Skip to content

Commit 1046cf2

Browse files
author
Callum McIntyre
committed
[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.
1 parent e4999ef commit 1046cf2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

XenAdmin/TabPages/PvsPage.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public partial class PvsPage : BaseTabPage
4949
private SelectionManager disableSelectionManager;
5050

5151
private DataGridViewVms_DefaultSort vmDefaultSort;
52+
53+
private readonly CollectionChangeEventHandler PvsProxy_CollectionChangedWithInvoke;
5254

5355
public PvsPage()
5456
{
@@ -61,7 +63,9 @@ public PvsPage()
6163
disableSelectionManager = new SelectionManager();
6264

6365
vmDefaultSort = new DataGridViewVms_DefaultSort();
64-
66+
67+
PvsProxy_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(PvsProxyCollectionChanged);
68+
6569
base.Text = Messages.PVS_TAB_TITLE;
6670
}
6771

@@ -75,16 +79,16 @@ public IXenConnection Connection
7579
{
7680
if (connection != null)
7781
{
78-
connection.Cache.DeregisterCollectionChanged<PVS_proxy>(PvsProxyCollectionChanged);
79-
connection.Cache.DeregisterCollectionChanged<VM>(PvsProxyCollectionChanged);
82+
connection.Cache.DeregisterCollectionChanged<PVS_proxy>(PvsProxy_CollectionChangedWithInvoke);
83+
connection.Cache.DeregisterCollectionChanged<VM>(PvsProxy_CollectionChangedWithInvoke);
8084
}
8185

8286
connection = value;
8387

8488
if (connection != null)
8589
{
86-
connection.Cache.RegisterCollectionChanged<PVS_proxy>(PvsProxyCollectionChanged);
87-
connection.Cache.RegisterCollectionChanged<VM>(PvsProxyCollectionChanged);
90+
connection.Cache.RegisterCollectionChanged<PVS_proxy>(PvsProxy_CollectionChangedWithInvoke);
91+
connection.Cache.RegisterCollectionChanged<VM>(PvsProxy_CollectionChangedWithInvoke);
8892
}
8993

9094
LoadVMs();
@@ -283,7 +287,7 @@ void dataGridViewVms_SortCompare(object sender, DataGridViewSortCompareEventArgs
283287

284288
private void PvsProxyCollectionChanged(object sender, CollectionChangeEventArgs e)
285289
{
286-
Program.Invoke(this, LoadVMs);
290+
LoadVMs();
287291
}
288292

289293
private void VmPropertyChanged(object sender, PropertyChangedEventArgs e)

0 commit comments

Comments
 (0)