Merge lp:~gary-lasker/software-center/fix-lp1023777-for-5.2 into lp:software-center/5.2

Proposed by Gary Lasker
Status: Merged
Merged at revision: 3062
Proposed branch: lp:~gary-lasker/software-center/fix-lp1023777-for-5.2
Merge into: lp:software-center/5.2
Diff against target: 14 lines (+3/-1)
1 file modified
softwarecenter/ui/gtk3/views/catview_gtk.py (+3/-1)
To merge this branch: bzr merge lp:~gary-lasker/software-center/fix-lp1023777-for-5.2
Reviewer Review Type Date Requested Status
Michael Vogt Needs Fixing
Review via email: mp+114699@code.launchpad.net

Commit message

* lp:~gary-lasker/software-center/fix-lp1023777-for-5.2:
   - fix crash in the case where the 'click_url' attribute has not yet
     been initialized at the time a banner is clicked (LP: #1023777)

Description of the change

We just received a bug report, bug 1023777, describing a crash in the new 'click_url' code. In examining the code, I can't quite see how this condition can occur, unless possibly if an exhibit banner is clicked very quickly at startup, before the call to query_exhibits returns its result. I was not able to reproduce this in testing, however.

I also don't see occurrances of this one on errors.ubuntu.com yet, but it's possible these may appear at some point.

In any case, this is a small fix that should take care of the problem in a straightforward way.

Thanks for your review!

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

Thanks for the branch and for noticing this bugreport. The original report was against quantal and there its
easy to reproduce, the bugtitle says:
 Title: software-center crashed with AttributeError in _on_show_exhibits(): 'FeaturedExhibit' object has no attribute 'click_url'

and indeed, the FeaturedExibit lacks this attribute, so adding it there via the approach below looks cleaner to me:

=== modified file 'softwarecenter/ui/gtk3/widgets/exhibits.py'
--- softwarecenter/ui/gtk3/widgets/exhibits.py 2012-07-10 03:23:44 +0000
+++ softwarecenter/ui/gtk3/widgets/exhibits.py 2012-07-13 07:13:16 +0000
@@ -93,6 +93,7 @@
             'title': _("Our star apps"),
             'subtitle': _("Come and explore our favourites"),
         }
+ self.click_url = ""
         # we should extract this automatically from the html
         #self.atk_name = _("Default Banner")
         #self.atk_description = _("You see this banner because you have no "

to test you can use trunk or 5.2 and run:
 $ SOFTWARE_CENTER_DISTRO_CODENAME=no-real-distro ./software-center
and click on the FeaturedExhibits banner to trigger both the original bug and the fix.

As this almost caused a regression in stable I added a regression test in trunk:
 lp:~mvo/software-center/fix-lp1023777

Should be easy to cherry pick this to 5.2 too.

review: Needs Fixing
Michael Vogt (mvo) wrote :

Thinking about this again and given how small it is, I merged it into 5.2 now with the minimal version that inits the click_url in FeaturedExhibit. This also has the nice benefit that the 5.2 branch is free of this (fortunately unreleased :) regression that I introduced via the original click_url branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/views/catview_gtk.py'
2--- softwarecenter/ui/gtk3/views/catview_gtk.py 2012-07-02 16:26:08 +0000
3+++ softwarecenter/ui/gtk3/views/catview_gtk.py 2012-07-12 18:46:27 +0000
4@@ -329,7 +329,9 @@
5
6 def _on_show_exhibits(self, exhibit_banner, exhibit):
7 pkgs = exhibit.package_names.split(",")
8- url = exhibit.click_url
9+ url = ""
10+ if hasattr(exhibit, "click_url"):
11+ url = exhibit.click_url
12 if url:
13 webbrowser.open_new_tab(url)
14 elif len(pkgs) == 1:

Subscribers

People subscribed via source and target branches