Blob Blame Raw
From d5a737e728351deeda858527999346d79abdb2f9 Mon Sep 17 00:00:00 2001
Message-Id: <d5a737e728351deeda858527999346d79abdb2f9.1384101775.git.crobinso@redhat.com>
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Wed, 30 Oct 2013 17:00:15 +0100
Subject: [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.4.2