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

Proposed by Gary Lasker
Status: Merged
Merge reported by: Gary Lasker
Merged at revision: not available
Proposed branch: lp:~gary-lasker/software-center/fix-crash-lp870822
Merge into: lp:software-center
Diff against target: 22 lines (+8/-4)
1 file modified
softwarecenter/ui/gtk3/views/appdetailsview.py (+8/-4)
To merge this branch: bzr merge lp:~gary-lasker/software-center/fix-crash-lp870822
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+104291@code.launchpad.net

Description of the change

This branch fixes a crash that a few people have gotten when viewing the appdetails pane, see bug 870822. The crash occurs during the calculation of the total size for the package. Under certain conditions, the installed size value is obtained from the cache itself by getting an AptCacheVersion object for the package. The crash occurs when a None is returned for the AptCacheVersion object.

In this case, with this fix we simply display the default "Unknown" value for size, as we have not been able to successfully determine it.

Unfortunately, I have been unable to reproduce this issue myself and so can't provide steps to do so, but we have gotten reports of it as late as software-center 5.2 final, so there are conditions under which it can occur and these conditions exist in our most recent versions.

This is a low-risk fix as we simply detect the None and display "Unknown" for that case.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for the branch. The fix is fine.

What puzzles me is that it can happen that we get None here when the applicaton says
its in the state "INSTALLED".

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/appdetailsview.py'
2--- softwarecenter/ui/gtk3/views/appdetailsview.py 2012-04-18 10:31:00 +0000
3+++ softwarecenter/ui/gtk3/views/appdetailsview.py 2012-05-01 20:26:18 +0000
4@@ -2024,10 +2024,14 @@
5 self.app_details.pkg_state == PkgStates.INSTALLED and
6 not self.addons_manager.addons_to_install and
7 not self.addons_manager.addons_to_remove):
8- pkg = self.cache[self.app_details.pkgname].installed
9- install_size = GLib.format_size(pkg.installed_size)
10- # FIXME: this is not really a good indication of the size on disk
11- label_string += _("%s on disk") % (install_size)
12+ pkg_version = self.cache[self.app_details.pkgname].installed
13+ # we may not always get a pkg_version returned (LP: #870822),
14+ # in that case, we'll just have to display "Unknown"
15+ if pkg_version:
16+ install_size = GLib.format_size(pkg_version.installed_size)
17+ # FIXME: this is not really a good indication of the size
18+ # on disk
19+ label_string += _("%s on disk") % (install_size)
20 elif total_install_size < 0:
21 remove_size = GLib.format_size(-total_install_size)
22 label_string += _("%s to be freed") % (remove_size)

Subscribers

People subscribed via source and target branches