screenshot: Properly clean up if PickColor() is cancelled

We currently only remove the screenshot operation from the shooter
map if the color pick operation completed successfully, but not if
it was cancelled. As a result, we now reject any further requests
from the same sender because we assume that there is an ongoing
operation.

Fix this by moving the cleanup to a finally clause that runs for
both code paths.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1288
This commit is contained in:
Florian Müllner 2020-05-29 00:27:34 +02:00
parent 1fdd4ff313
commit 55c287280b

View File

@ -276,12 +276,13 @@ var ScreenshotService = class {
blue / 255.0, blue / 255.0,
]), ]),
}]); }]);
this._removeShooterForSender(invocation.get_sender());
invocation.return_value(retval); invocation.return_value(retval);
} catch (e) { } catch (e) {
invocation.return_error_literal( invocation.return_error_literal(
Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED, Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
'Operation was cancelled'); 'Operation was cancelled');
} finally {
this._removeShooterForSender(invocation.get_sender());
} }
} }
}; };