[MM-34067] Explicitly destroy web contents in non-permanent BrowserViews (#1519)

* [MM-34067] Explicitly destroy web contents in non-permanent BrowserViews

* Comment to remove this later
This commit is contained in:
Devin Binnie
2021-03-26 09:36:19 -04:00
committed by GitHub
parent 66a2c3f7b1
commit be31e3eed0
3 changed files with 14 additions and 1 deletions

View File

@@ -171,6 +171,11 @@ export class MattermostView extends EventEmitter {
if (this.window) { if (this.window) {
this.window.removeBrowserView(this.view); this.window.removeBrowserView(this.view);
} }
// workaround to eliminate zombie processes
// https://github.com/mattermost/desktop/pull/1519
this.view.webContents.destroy();
this.window = null; this.window = null;
this.server = null; this.server = null;
this.isVisible = false; this.isVisible = false;

View File

@@ -70,8 +70,12 @@ export class ModalView {
if (this.view.webContents.isDevToolsOpened()) { if (this.view.webContents.isDevToolsOpened()) {
this.view.webContents.closeDevTools(); this.view.webContents.closeDevTools();
} }
this.windowAttached.removeBrowserView(this.view); this.windowAttached.removeBrowserView(this.view);
// workaround to eliminate zombie processes
// https://github.com/mattermost/desktop/pull/1519
this.view.webContents.destroy();
this.windowAttached = null; this.windowAttached = null;
this.status = ACTIVE; this.status = ACTIVE;
} }

View File

@@ -203,6 +203,10 @@ export class ViewManager {
const hideView = () => { const hideView = () => {
this.urlViewCancel = null; this.urlViewCancel = null;
currentWindow.removeBrowserView(urlView); currentWindow.removeBrowserView(urlView);
// workaround to eliminate zombie processes
// https://github.com/mattermost/desktop/pull/1519
urlView.webContents.destroy();
}; };
const timeout = setTimeout(hideView, const timeout = setTimeout(hideView,