Merge lp:~gary-lasker/software-center/fix-crash-lp968988 into lp:software-center

Proposed by Gary Lasker
Status: Merged
Merged at revision: 2950
Proposed branch: lp:~gary-lasker/software-center/fix-crash-lp968988
Merge into: lp:software-center
Diff against target: 39 lines (+8/-3)
2 files modified
softwarecenter/ui/gtk3/views/appview.py (+7/-3)
softwarecenter/ui/gtk3/widgets/apptreeview.py (+1/-0)
To merge this branch: bzr merge lp:~gary-lasker/software-center/fix-crash-lp968988
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+101330@code.launchpad.net

Description of the change

Fix crash bug 968988 by making sure that there is always a tree_view.selected_row_renderer attribute, and do the right thing in the case where it may be None. You can verify there is no regression using the corresponding unit test:

  cd test
  PYTHONPATH=. python gtk3/test_unity_launcher_integration.py

Thanks!

To post a comment you must log in.
Michael Vogt (mvo) wrote :

Thanks, that looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/views/appview.py'
2--- softwarecenter/ui/gtk3/views/appview.py 2012-03-29 13:57:04 +0000
3+++ softwarecenter/ui/gtk3/views/appview.py 2012-04-10 05:10:24 +0000
4@@ -235,7 +235,8 @@
5 for the application icon as it is displayed on-screen
6 """
7 icon_size = 32
8- if self.tree_view.selected_row_renderer.icon:
9+ if (self.tree_view.selected_row_renderer and
10+ self.tree_view.selected_row_renderer.icon):
11 pb = self.tree_view.selected_row_renderer.icon
12 if pb.get_width() > pb.get_height():
13 icon_size = pb.get_width()
14@@ -254,8 +255,11 @@
15 # get toplevel window position
16 (px, py) = parent.get_position()
17 # and return the coordinate values
18- return (px + self.tree_view.selected_row_renderer.icon_x_offset,
19- py + self.tree_view.selected_row_renderer.icon_y_offset)
20+ if self.tree_view.selected_row_renderer:
21+ return (px + self.tree_view.selected_row_renderer.icon_x_offset,
22+ py + self.tree_view.selected_row_renderer.icon_y_offset)
23+ else:
24+ return (px, py)
25
26
27 # ----------------------------------------------- testcode
28
29=== modified file 'softwarecenter/ui/gtk3/widgets/apptreeview.py'
30--- softwarecenter/ui/gtk3/widgets/apptreeview.py 2012-03-30 10:39:02 +0000
31+++ softwarecenter/ui/gtk3/widgets/apptreeview.py 2012-04-10 05:10:24 +0000
32@@ -46,6 +46,7 @@
33 self._action_block_list = []
34 self._needs_collapse = []
35 self.expanded_path = None
36+ self.selected_row_renderer = None
37
38 # pixbuf for the icon that is displayed in the selected row
39 self.selected_row_icon = None

Subscribers

People subscribed via source and target branches