abe33 / abe33/minimap-pigments

Error deactivating package 'minimap-pigments' TypeError: Cannot read property 'dispose' of undefined

Open Beginner friendly
#6 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
CoffeeScript
Stars
15
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Noticed this while developing another plugin, triggered when reloading the window:

```
/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:655 Error deactivating package 'minimap-pigments' TypeError: Cannot read property 'dispose' of undefined
at Object.module.exports.deactivate (/Users/viddo/.atom/packages/minimap-pigments/lib/minimap-pigments.coffee:24:25)
at Package.module.exports.Package.deactivate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:644:21)
at PackageManager.module.exports.PackageManager.deactivatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:622:12)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:608:19
at Config.module.exports.Config.transact (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:312:16)
at PackageManager.module.exports.PackageManager.deactivatePackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:602:19)
at AtomEnvironment.module.exports.AtomEnvironment.unloadEditorWindow (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:799:21)
at WindowEventHandler.module.exports.WindowEventHandler.handleWindowBeforeunload (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:196:30)
at /Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61module.exports.Package.deactivate @ /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:655module.exports.PackageManager.deactivatePackage @ /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:622(anonymous function) @ /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:608module.exports.Config.transact @ /Applications/Atom.app/Contents/Resources/app.asar/src/config.js:312module.exports.PackageManager.deactivatePackages @ /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:602module.exports.AtomEnvironment.unloadEditorWindow @ /Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:799module.exports.WindowEventHandler.handleWindowBeforeunload @ /Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:196(anonymous function) @ /Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3
```

https://github.com/abe33/minimap-pigments/blob/master/lib/minimap-pigments.coffee#L24 `@editorsSubscription` does not always exist, it seems

Contributor guide

No contributing guide indexed for this repository

Research direction

The error occurs in lib/minimap-pigments.coffee at line 24, where @editorsSubscription.dispose is called but @editorsSubscription may be undefined. Check the deactivate method to see where @editorsSubscription is initialized, and add a guard condition before calling dispose. Run the plugin in Atom to verify the fix by reloading the window and ensuring no error appears in the developer console.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.