diff options
author | Ray Strode <rstrode@redhat.com> | 2020-10-06 10:29:00 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2020-10-07 17:03:52 -0400 |
commit | b41ef2f6e3b2a801331d846ac5fbfd5d349eb4e5 (patch) | |
tree | 2804f3bc01308c06057f1787f248b5fb03a65dbe | |
parent | 9963f7ce845362c59dac953a71fbac98f447c13d (diff) | |
download | gnome-shell-b41ef2f6e3b2a801331d846ac5fbfd5d349eb4e5.tar.gz |
panel: Disconnect destroy signal handler when needed
The panel corners try to match their style to the buttons closest
to them. In order to make sure the corner styles stay in sync with
their neighboring buttons, they connect to the style-changed signals
of the buttons.
In order to make sure the style-changed signal handler isn't leaked,
it gets disconnected when the button is destroyed.
Unfortunately, the destroy signal handler connection itself gets leaked!
This commit ensures the destroy signal handler gets disconnected any
time the neighboring button is re-determined.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1460
-rw-r--r-- | js/ui/panel.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/js/ui/panel.js b/js/ui/panel.js index b168907de..272368a4b 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -591,14 +591,19 @@ class PanelCorner extends St.DrawingArea { button = this._findRightmostButton(box); if (button) { - if (this._button && this._buttonStyleChangedSignalId) { - this._button.disconnect(this._buttonStyleChangedSignalId); - this._button.style = null; + if (this._button) { + if (this._buttonStyleChangedSignalId) { + this._button.disconnect(this._buttonStyleChangedSignalId); + this._button.style = null; + } + + if (this._buttonDestroySignalId) + this._button.disconnect(this._buttonDestroySignalId); } this._button = button; - button.connect('destroy', () => { + this._buttonDestroySignalId = button.connect('destroy', () => { if (this._button == button) { this._button = null; this._buttonStyleChangedSignalId = 0; |