Skip to content

Commit

Permalink
safe overview handlers disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Mar 24, 2018
1 parent c2e229b commit be90111
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions unite@hardpixel.eu/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ function collectWindowButtons(layout_items) {
return items;
}

function overviewSignals(handlers) {
let signals = [];

Main.overview._signalConnections.forEach(function (item) {
if (handlers.indexOf(item.id) > -1 && !item.disconnected) {
signals.push(item.id);
}
});

return signals;
}

function isMaximized(win, match_state) {
let check = false;
let flags = Meta.MaximizeFlags;
Expand Down
3 changes: 3 additions & 0 deletions unite@hardpixel.eu/modules/activitiesButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Panel = Main.panel;
const AppMenu = Panel.statusArea.appMenu;
const ExtensionUtils = imports.misc.extensionUtils;
const Unite = ExtensionUtils.getCurrentExtension();
const Helpers = Unite.imports.helpers;
const Convenience = Unite.imports.convenience;

var ActivitiesButton = new Lang.Class({
Expand Down Expand Up @@ -44,6 +45,8 @@ var ActivitiesButton = new Lang.Class({
},

_disconnectSignals: function() {
this._ovHandlerIDs = Helpers.overviewSignals(this._ovHandlerIDs);

if (this._wtHandlerID) {
WindowTracker.disconnect(this._wtHandlerID);
delete this._wtHandlerID;
Expand Down
3 changes: 3 additions & 0 deletions unite@hardpixel.eu/modules/desktopName.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Panel = Main.panel;
const AppMenu = Panel.statusArea.appMenu;
const ExtensionUtils = imports.misc.extensionUtils;
const Unite = ExtensionUtils.getCurrentExtension();
const Helpers = Unite.imports.helpers;
const Convenience = Unite.imports.convenience;

var DesktopName = new Lang.Class({
Expand Down Expand Up @@ -44,6 +45,8 @@ var DesktopName = new Lang.Class({
},

_disconnectSignals: function() {
this._ovHandlerIDs = Helpers.overviewSignals(this._ovHandlerIDs);

if (this._wtHandlerID) {
WindowTracker.disconnect(this._wtHandlerID);
delete this._wtHandlerID;
Expand Down
2 changes: 2 additions & 0 deletions unite@hardpixel.eu/modules/windowButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ var WindowButtons = new Lang.Class({
},

_disconnectSignals: function() {
this._ovHandlerIDs = Helpers.overviewSignals(this._ovHandlerIDs);

if (this._dsHandlerID) {
global.display.disconnect(this._dsHandlerID);
delete this._dsHandlerID;
Expand Down

0 comments on commit be90111

Please sign in to comment.