Skip to content

Commit

Permalink
locations: Ensure we always remove tracked launch timeout sources
Browse files Browse the repository at this point in the history
  • Loading branch information
3v1n0 committed Feb 27, 2023
1 parent 3ed707c commit 5572edf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,24 +355,24 @@ var LocationAppInfo = GObject.registerClass({
let handler, error, launchMaxWaitId;
Promise.race([
this._getHandlerAppAsync(cancellable),
new Promise((resolve, reject) =>
(launchMaxWaitId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
new Promise((resolve, reject) => {
launchMaxWaitId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
LAUNCH_HANDLER_MAX_WAIT, () => {
this._launchMaxWaitIds.delete(launchMaxWaitId);
launchMaxWaitId = 0;
cancellable.cancel();
reject(new GLib.Error(Gio.IOErrorEnum,
Gio.IOErrorEnum.TIMED_OUT,
`Searching for ${this.get_id()} handler took too long`));
return GLib.SOURCE_REMOVE;
}))
),
});
this._launchMaxWaitIds.add(launchMaxWaitId);
}),
]).then(h => (handler = h)).catch(e => (error = e));

if (this._launchMaxWaitIds === undefined)
this._launchMaxWaitIds = new Set();

this._launchMaxWaitIds.add(launchMaxWaitId);

while (handler === undefined && error === undefined)
GLib.MainContext.default().iteration(false);

Expand Down

0 comments on commit 5572edf

Please sign in to comment.