From c11675dca12d91dfcb626d68844863ee1ccf0b8b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 16 Oct 2014 13:17:53 -0600 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20recycle=20the=20same=20composit?= =?UTF-8?q?e=20disposable=20for=20stylesheet=20activation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/package.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index 77a8a775f..c465a3cb8 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -50,6 +50,7 @@ class Package keymaps: null menus: null stylesheets: null + stylesheetDisposables: null grammars: null scopedProperties: null mainModulePath: null @@ -62,7 +63,6 @@ class Package constructor: (@path, @metadata) -> @emitter = new Emitter - @stylesheetDisposables = new CompositeDisposable @metadata ?= Package.loadMetadata(@path) @bundledPackage = Package.isBundledPackagePath(@path) @name = @metadata?.name ? path.basename(@path) @@ -178,8 +178,9 @@ class Package context = 'atom-text-editor' if @metadata.theme is 'syntax' group = @getStylesheetType() + @stylesheetDisposables = new CompositeDisposable for [sourcePath, source] in @stylesheets - @stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, sourcePath, context})) + @stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, group, context})) @stylesheetsActivated = true activateResources: -> @@ -322,7 +323,7 @@ class Package deactivateResources: -> grammar.deactivate() for grammar in @grammars scopedProperties.deactivate() for scopedProperties in @scopedProperties - atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in @stylesheets + @stylesheetDisposables?.dispose() @activationDisposables?.dispose() @stylesheetsActivated = false @grammarsActivated = false