authPrompt: Manually destroy inactive/unused entry

AuthPrompt creates two entries, one for text and one for passwords, but
only ever one is used as child widget. This would lead to the other one
not getting destroyed when the the AuthPrompt is destroyed.

This now manually destroys the inactive one when the AuthPrompt is
destroyed to avoid that leak.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6395
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2637>
(cherry picked from commit 572d011894)
This commit is contained in:
Sebastian Keller 2023-02-12 18:13:59 +01:00 committed by Florian Müllner
parent 91050f0611
commit e428a7f8da

View file

@ -122,6 +122,8 @@ var AuthPrompt = GObject.registerClass({
}
_onDestroy() {
this._inactiveEntry.destroy();
this._inactiveEntry = null;
this._userVerifier.destroy();
this._userVerifier = null;
}
@ -191,6 +193,7 @@ var AuthPrompt = GObject.registerClass({
this._entry = this._passwordEntry;
this._mainBox.add_child(this._entry);
this._entry.grab_key_focus();
this._inactiveEntry = this._textEntry;
this._timedLoginIndicator = new St.Bin({
style_class: 'login-dialog-timed-login-indicator',
@ -280,9 +283,11 @@ var AuthPrompt = GObject.registerClass({
if (secret && this._entry !== this._passwordEntry) {
this._mainBox.replace_child(this._entry, this._passwordEntry);
this._entry = this._passwordEntry;
this._inactiveEntry = this._textEntry;
} else if (!secret && this._entry !== this._textEntry) {
this._mainBox.replace_child(this._entry, this._textEntry);
this._entry = this._textEntry;
this._inactiveEntry = this._passwordEntry;
}
this._capsLockWarningLabel.visible = secret;
}