[virt-tools-list] [virt-manager PATCH] host: unselect all members before clear model
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Fri Mar 14 01:05:24 UTC 2014
> -----Original Message-----
> From: Cole Robinson [mailto:crobinso at redhat.com]
> Sent: Thursday, March 13, 2014 11:04 PM
> To: Chen Hanxiao; virt-tools-list at redhat.com
> Subject: Re: [virt-tools-list] [virt-manager PATCH] host: unselect all
members
> before clear model
>
> On 03/13/2014 06:03 AM, Chen Hanxiao wrote:
> > 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 at cn.fujitsu.com>
> > ---
> > virtManager/host.py | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/virtManager/host.py b/virtManager/host.py
> > index c8d7ee0..a1aa2fd 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():
> >
>
> ACK
>
> Thanks,
> Cole
Pushed.
More information about the virt-tools-list
mailing list