[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH] virtManager: do not call set_cell_data_func with an empty func



It fixes this exception:

Traceback (most recent call last):
  File "src/virt-manager/virtManager/engine.py", line 133, in _activate
    self.show_manager()
  File "src/virt-manager/virtManager/engine.py", line 867, in show_manager
    self._do_show_manager(None)
  File "src/virt-manager/virtManager/engine.py", line 811, in _do_show_manager
    manager = self.get_manager()
  File "src/virt-manager/virtManager/engine.py", line 772, in get_manager
    obj = vmmManager()
  File "src/virt-manager/virtManager/manager.py", line 173, in __init__
    self.init_stats()
  File "src/virt-manager/virtManager/manager.py", line 276, in init_stats
    self.toggle_host_cpu_usage_visible_widget()
  File "src/virt-manager/virtManager/manager.py", line 1026, in toggle_host_cpu_usage_visible_widget
    self.host_cpu_usage_img, "menu_view_stats_host_cpu")
  File "src/virt-manager/virtManager/manager.py", line 1003, in _toggle_graph_helper
    col.set_cell_data_func(img, datafunc, None)
  File "/usr/lib/python2.7/site-packages/gi/overrides/Gtk.py", line 1320, in set_cell_data_func
    super(TreeViewColumn, self).set_cell_data_func(cell_renderer, func, func_data)
TypeError: When passing None for a callback userdata must also be None

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1024569

Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
---
 virtManager/manager.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/virtManager/manager.py b/virtManager/manager.py
index 114904b..fe5be75 100644
--- a/virtManager/manager.py
+++ b/virtManager/manager.py
@@ -998,9 +998,8 @@ class vmmManager(vmmGObjectUI):
         for child in col.get_cells():
             if isinstance(child, CellRendererSparkline):
                 img = child
-        datafunc = do_show and datafunc or None
-
-        col.set_cell_data_func(img, datafunc, None)
+        if do_show:
+            col.set_cell_data_func(img, datafunc, None)
         col.set_visible(do_show)
         self.widget(menu).set_active(do_show)
 
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]