Don’t recycle the same composite disposable for stylesheet activation

This commit is contained in:
Nathan Sobo
2014-10-16 13:17:53 -06:00
parent cdb62812d2
commit c11675dca1

View File

@@ -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