After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789680 - Wrong install cancelled after switching apps
Wrong install cancelled after switching apps
Status: RESOLVED FIXED
Product: gnome-software
Classification: Applications
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: GNOME Software maintainer(s)
GNOME Software maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-10-31 02:35 UTC by Robert Ancell
Modified: 2017-11-02 22:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use the correct GCancellable when switching between apps (8.04 KB, patch)
2017-10-31 04:02 UTC, Robert Ancell
none Details | Review

Description Robert Ancell 2017-10-31 02:35:25 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.
Comment 1 Robert Ancell 2017-10-31 02:36:26 UTC
Ubuntu bug: https://bugs.launchpad.net/bugs/1722183
Comment 2 Robert Ancell 2017-10-31 02:37:34 UTC
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.
Comment 3 Robert Ancell 2017-10-31 04:02:42 UTC
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?
Comment 4 Robert Ancell 2017-11-02 22:33:28 UTC
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.