diff options
author | Chen Hanxiao <chenhanxiao@cn.fujitsu.com> | 2014-03-14 09:04:34 +0800 |
---|---|---|
committer | Chen Hanxiao <chenhanxiao@cn.fujitsu.com> | 2014-03-14 09:04:52 +0800 |
commit | 1d3980015a942e5aceee0233c9b90d2bbe32ffdd (patch) | |
tree | b2e7c746402432ffe7e67eb0027c0ce42e1447c1 | |
parent | 81696a514441f2320ea10299e1852795f8cb1682 (diff) | |
download | virt-manager-1d3980015a942e5aceee0233c9b90d2bbe32ffdd.tar.gz |
host: unselect_all members before clear model
Interface_selected is being triggered by model.clear() in
populate_interfaces. It usually calls interface_selected
on every interface after the current selected row.
So the gtk code is probably removing the first
row over and over, and when it removes the
current selection (the interface we are deleting),
it selects the next row in line.
It will raise a KeyError.
This patch will fix this issue.
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
-rw-r--r-- | virtManager/host.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/virtManager/host.py b/virtManager/host.py index c8d7ee07..a1aa2fd0 100644 --- a/virtManager/host.py +++ b/virtManager/host.py @@ -679,6 +679,7 @@ class vmmHost(vmmGObjectUI): curnet = self.current_network() net_list = self.widget("net-list") + net_list.get_selection().unselect_all() model.clear() for uuid in self.conn.list_net_uuids(): net = self.conn.get_net(uuid) @@ -1220,6 +1221,7 @@ class vmmHost(vmmGObjectUI): curiface = self.current_interface() iface_list = self.widget("interface-list") + iface_list.get_selection().unselect_all() model.clear() for name in self.conn.list_interface_names(): iface = self.conn.get_interface(name) @@ -1234,6 +1236,7 @@ class vmmHost(vmmGObjectUI): interface = self.current_interface() child_list = self.widget("interface-child-list") model = child_list.get_model() + child_list.get_selection().unselect_all() model.clear() if not interface: @@ -1278,6 +1281,7 @@ def populate_storage_pools(pool_list, conn, curpool): model = pool_list.get_model() # Prevent events while the model is modified pool_list.set_model(None) + pool_list.get_selection().unselect_all() model.clear() for uuid in conn.list_pool_uuids(): per = get_pool_size_percent(conn, uuid) @@ -1297,6 +1301,7 @@ def populate_storage_pools(pool_list, conn, curpool): def populate_storage_volumes(list_widget, pool, sensitive_cb): vols = pool and pool.get_volumes() or {} model = list_widget.get_model() + list_widget.get_selection().unselect_all() model.clear() for key in vols.keys(): |