GNOME Bugzilla – Bug 789680
Wrong install cancelled after switching apps
Last modified: 2017-11-02 22:33:28 UTC
Due to a logic bug pressing cancel on the app details page for an installing app can cancel another install. Steps to reproduce: 1. Open GNOME Software 2. Select an uninstalled app (e.g. from the Editor's Picks). 3. Install the app 4. Go back to the overview page 5. Select another uninstalled app 6. Install the second app 7. Go back to the overview page 8. Select the first app 9. Cancel installation Expected result: The first app install is cancelled. Observed result: The second app install is cancelled. The bug is caused because the details page retains the GCancellable from the second app installation when you return to the first app.
Ubuntu bug: https://bugs.launchpad.net/bugs/1722183
I've been trying to make a patch for this but it seems quite tricky. The GTask for an install doesn't seem to be retrievable once it is initiated so there's no easy way to find the appropriate GCancellable to use. Will probably require some refactoring.
Created attachment 362595 [details] [review] Use the correct GCancellable when switching between apps This seems to fix the problem, but I'm not sure about: - Thread safety in GsPluginLoader - Function naming - Is it appropriate to just check the GsApp memory value?
Fixed in master in the following changes: commit 7264d34522b1cd16db68c196ed175638b86fea2b Author: Joaquim Rocha <jrocha@endlessm.com> Date: Tue Oct 10 12:26:20 2017 +0200 Allow to cancel app ops in the details view that were started elsewhere The cancellation of app related operations has been tied to each view individually. E.g. if an app update is started from the updates page and the user goes to that app's details page, even though there is a cancel button showing, it won't do anything because it's cancellable object is not the one with which the update operation was started. Now that each app has a cancellable object, this patch makes use of that to ensure that any operations related to the app are cancellable even if they were started from a different page. commit da83bd73a66f4f1efb45a2d2a7b348599832ad0c Author: Joaquim Rocha <jrocha@endlessm.com> Date: Tue Oct 10 12:21:55 2017 +0200 Add a cancellable to GsApp objects This cancellable should be used in operations related to the app, e.g. installing, updating, etc. This is convenient because sometimes an operation will be shown in different views, so we cannot use a local cancellable, as it will be impossible to start the operation in one view and cancel it in another.