https://bugzilla.redhat.com/show_bug.cgi?id=551989
Apparently self.dlist.get_selection() sometimes returns None.
This patch takes care of this case.
Please review.
--
vda
diff -x '*.po' -d -urpN abrt.8/src/Gui/CCMainWindow.py
abrt.9/src/Gui/CCMainWindow.py
--- abrt.8/src/Gui/CCMainWindow.py 2010-03-31 16:38:01.000000000 +0200
+++ abrt.9/src/Gui/CCMainWindow.py 2010-04-01 15:34:56.583226664 +0200
@@ -195,8 +195,10 @@ class MainWindow():
return True
def on_tvDumps_cursor_changed(self, treeview):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
- if not path:
+ selection = self.dlist.get_selection()
+ if selection:
+ dumpsListStore, path = selection.get_selected_rows()
+ if not selection or not path:
self.wTree.get_widget("bDelete").set_sensitive(False)
self.wTree.get_widget("bReport").set_sensitive(False)
self.wTree.get_widget("b_copy").set_sensitive(False)
@@ -291,7 +293,10 @@ class MainWindow():
return False
def on_bDelete_clicked(self, button, treeview):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
+ selection = self.dlist.get_selection()
+ if not selection:
+ return
+ dumpsListStore, path = selection.get_selected_rows()
if not path:
return
# this should work until we keep the dump object in the last position
@@ -311,9 +316,11 @@ class MainWindow():
print ex
def dumplist_get_selected(self):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
- if path and dumpsListStore:
- return dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)
+ selection = self.dlist.get_selection()
+ if selection:
+ dumpsListStore, path = selection.get_selected_rows()
+ if path and dumpsListStore:
+ return dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)
return None
def on_b_copy_clicked(self, button):
@@ -343,9 +350,11 @@ class MainWindow():
# FIXME mark the new entry somehow....
# remember the selected row
last_dump = None
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
- if path and dumpsListStore:
- last_dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)
+ selection = self.dlist.get_selection()
+ if selection:
+ dumpsListStore, path = selection.get_selected_rows()
+ if path and dumpsListStore:
+ last_dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)
self.hydrate()
if last_dump:
# re-select the line that was selected before a new crash happened
@@ -353,11 +362,16 @@ class MainWindow():
def on_bReport_clicked(self, button):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
- self.on_dumpRowActivated(self.dlist, None, path, None)
+ selection = self.dlist.get_selection()
+ if selection:
+ dumpsListStore, path = selection.get_selected_rows()
+ self.on_dumpRowActivated(self.dlist, None, path, None)
def on_dumpRowActivated(self, treeview, it, path, user_data=None):
- dumpsListStore, path = treeview.get_selection().get_selected_rows()
+ selection = self.dlist.get_selection()
+ if not selection:
+ return
+ dumpsListStore, path = selection.get_selected_rows()
if not path:
return
dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)