From 98f48a66c393efed31da63a666556a3e39c06eda Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 27 Jun 2019 02:21:04 -0500 Subject: [PATCH] Fix install --- src/App.js | 14 +++++++++----- src/redux/actions/install_actions.js | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/App.js b/src/App.js index 0ab4b06..a2f610d 100644 --- a/src/App.js +++ b/src/App.js @@ -56,7 +56,10 @@ class App extends IPCContainer { } }; + _isMounted = false; + componentDidMount() { + this._isMounted = true; this.scheduledUpdateJob = Scheduler.scheduleJob('23 11 * * *', this.updateCheckScheduledJob); this.detectUpgrades(); } @@ -75,6 +78,7 @@ class App extends IPCContainer { } componentWillUnmount() { + this._isMounted = false; Scheduler.cancelJob(this.scheduledUpdateJob); super.componentWillUnmount(); } @@ -123,7 +127,7 @@ class App extends IPCContainer { if (result.Success) { const selectedVersion = this.getSelectedVersion(); this.props.installRelease(result.Destination, selectedVersion, () => { - if (this.isMounted()) { + if (this._isMounted) { this.checkVersionInstalled(); } }); @@ -140,7 +144,7 @@ class App extends IPCContainer { }; onDownloadFileComplete = (name, type, url, result) => { - if (this.isMounted()) { + if (this._isMounted) { switch (type) { case Constants.INSTALL_TYPES.Dependency: this.installDependency(result); @@ -159,7 +163,7 @@ class App extends IPCContainer { }; onInstallDependencyComplete = (source, url, result) => { - if (this.isMounted()) { + if (this._isMounted) { if (result.Success && source.toLowerCase().endsWith('.dmg')) { this.waitForDependencyInstall(source, url); } else { @@ -172,9 +176,9 @@ class App extends IPCContainer { }; onInstallUpgradeComplete = (source, result) => { - if (this.isMounted() && !result.Success) { + if (this._isMounted && !result.Success) { this.props.notifyError(result.Error, false,() => { - if (this.isMounted()) { + if (this._isMounted) { // TODO Prompt to verify if (result.AllowSkipVerification) { this.installUpgrade({ diff --git a/src/redux/actions/install_actions.js b/src/redux/actions/install_actions.js index 4e07626..5567a70 100644 --- a/src/redux/actions/install_actions.js +++ b/src/redux/actions/install_actions.js @@ -79,7 +79,7 @@ export const installRelease = (source, version, completedCallback) => { const extractReleaseComplete = (event, arg) => { ipcRenderer.removeListener(Constants.IPC_Extract_Release_Complete, extractReleaseComplete); - ipcRenderer.sendSync(Constants.IPC_Delete_File, { + ipcRenderer.send(Constants.IPC_Delete_File, { FilePath: source, }); @@ -103,7 +103,7 @@ export const installUpgrade = (source, sha256, signature, skipVerification, comp const installUpgradeComplete = (event, arg) => { ipcRenderer.removeListener(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete); - ipcRenderer.sendSync(Constants.IPC_Delete_File, { + ipcRenderer.send(Constants.IPC_Delete_File, { FilePath: source, });