polkitAgent: Destroy session from dialogue closed handler

Rather than explicitly destroying the session after calling close(),
destroy it from the `closed` signal handler.

This also means we can make the method internal.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/357
This commit is contained in:
Philip Withnall 2019-01-21 18:11:59 +00:00 committed by Florian Müllner
parent ddd1825162
commit 081d94e0f6

View File

@ -168,7 +168,7 @@ var AuthenticationDialog = new Lang.Class({
},
performAuthentication() {
this.destroySession();
this._destroySession();
this._session = new PolkitAgent.Session({ identity: this._identityToAuth,
cookie: this._cookie });
this._sessionCompletedId = this._session.connect('completed', this._onSessionCompleted.bind(this));
@ -300,7 +300,7 @@ var AuthenticationDialog = new Lang.Class({
this._ensureOpen();
},
destroySession() {
_destroySession() {
if (this._session) {
if (!this._completed)
this._session.cancel();
@ -331,6 +331,8 @@ var AuthenticationDialog = new Lang.Class({
if (this._sessionUpdatedId)
Main.sessionMode.disconnect(this._sessionUpdatedId);
this._sessionUpdatedId = 0;
this._destroySession();
},
});
Signals.addSignalMethods(AuthenticationDialog.prototype);
@ -401,7 +403,6 @@ var AuthenticationAgent = new Lang.Class({
_completeRequest(dismissed) {
this._currentDialog.close();
this._currentDialog.destroySession();
this._currentDialog = null;
if (this._sessionUpdatedId)