From 3b2c6afdaf1c901dd23e4d6e2e4be53315f9d3c7 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 17 Nov 2015 16:23:38 -0800 Subject: [PATCH 1/3] Fix removeListener calls --- spec/atom-environment-spec.coffee | 14 ++++++++++++++ src/application-delegate.coffee | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/spec/atom-environment-spec.coffee b/spec/atom-environment-spec.coffee index f9dbc02f9..ea5258556 100644 --- a/spec/atom-environment-spec.coffee +++ b/spec/atom-environment-spec.coffee @@ -249,6 +249,20 @@ describe "AtomEnvironment", -> expect(buffer.getSubscriptionCount()).toBe 0 + it "does not throw exceptions when unsubscribing from ipc events (regression)", -> + configDirPath = temp.mkdirSync() + fakeDocument = { + addEventListener: -> + removeEventListener: -> + head: document.createElement('head') + body: document.createElement('body') + } + atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, window, document: fakeDocument}) + spyOn(atomEnvironment.packages, 'getAvailablePackagePaths').andReturn [] + atomEnvironment.startEditorWindow() + atomEnvironment.unloadEditorWindow() + atomEnvironment.destroy() + describe "::openLocations(locations) (called via IPC from browser process)", -> beforeEach -> spyOn(atom.workspace, 'open') diff --git a/src/application-delegate.coffee b/src/application-delegate.coffee index 1999c6e83..1e05b3dbb 100644 --- a/src/application-delegate.coffee +++ b/src/application-delegate.coffee @@ -138,7 +138,7 @@ class ApplicationDelegate ipc.on('message', outerCallback) new Disposable -> - ipc.removeEventListener('message', outerCallback) + ipc.removeListener('message', outerCallback) onUpdateAvailable: (callback) -> outerCallback = (message, detail) -> @@ -147,17 +147,17 @@ class ApplicationDelegate ipc.on('message', outerCallback) new Disposable -> - ipc.removeEventListener('message', outerCallback) + ipc.removeListener('message', outerCallback) onApplicationMenuCommand: (callback) -> ipc.on('command', callback) new Disposable -> - ipc.removeEventListener('command', callback) + ipc.removeListener('command', callback) onContextMenuCommand: (callback) -> ipc.on('context-command', callback) new Disposable -> - ipc.removeEventListener('context-command', callback) + ipc.removeListener('context-command', callback) didCancelWindowUnload: -> ipc.send('did-cancel-window-unload') From 6e72ebb8861464765fec5a7a237068b17a1a75bc Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 17 Nov 2015 16:28:53 -0800 Subject: [PATCH 2/3] Load packages before deserializing workspace This ensures that package-defined deserializers work. --- src/atom-environment.coffee | 2 +- src/initialize-application-window.coffee | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index dcd7ca0ea..d24a33d7c 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -612,7 +612,7 @@ class AtomEnvironment extends Model @registerDefaultTargetForKeymaps() @packages.loadPackages() - + @loadStateSync() @document.body.appendChild(@views.getView(@workspace)) @watchProjectPath() diff --git a/src/initialize-application-window.coffee b/src/initialize-application-window.coffee index acf50bc5d..9294cc07f 100644 --- a/src/initialize-application-window.coffee +++ b/src/initialize-application-window.coffee @@ -24,7 +24,6 @@ window.atom = new AtomEnvironment({ }) atom.displayWindow() -atom.loadStateSync() atom.startEditorWindow() # Workaround for focus getting cleared upon window creation From b0fda338dd349a32cbdd3c7a5802a654ae15a913 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 17 Nov 2015 16:47:36 -0800 Subject: [PATCH 3/3] 1.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0186d9948..7f0914b69 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.2.1", + "version": "1.2.2", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": {