atom / text-buffer

Atom's underlying text buffer
MIT License
144 stars 73 forks source link

DisplayLayer.updateSpatialIndex error #297

Open Arcanemagus opened 6 years ago

Arcanemagus commented 6 years ago

Prerequisites

Description

When restoring window state Atom threw the following error.

Uncaught TypeError: Cannot read property 'length' of undefined

At C:\temp\atom\out\Atom x64\resources\app\node_modules\text-buffer\lib\display-layer.js:982

TypeError: Cannot read property 'length' of undefined
    at DisplayLayer.updateSpatialIndex (C:/temp/atom/out/Atom x64/resources/app/node_modules/text-buffer/lib/display-layer.js:982:46)
    at DisplayLayer.populateSpatialIndexIfNeeded (C:/temp/atom/out/Atom x64/resources/app/node_modules/text-buffer/lib/display-layer.js:1069:18)
    at DisplayLayer.doBackgroundWork (C:/temp/atom/out/Atom x64/resources/app/node_modules/text-buffer/lib/display-layer.js:141:16)
    at TextEditor.doBackgroundWork (C:/temp/atom/out/Atom x64/resources/app/src/text-editor.js:313:33)

Steps to Reproduce

  1. Start Atom in safe mode restoring a specific state

Expected behavior:

No error to be thrown.

Actual behavior:

Atom throws an error on launch.

Reproduces how often:

100% of the time... until I tried to dig further and find reproduction steps by starting in --dev, now 0% of the time.

Versions

Atom: 1.28.0-dev-b72501aaa x64 Electron: 1.7.11 OS: Microsoft Windows 10 Enterprise text-buffer: 13.14.1

Arcanemagus commented 6 years ago

If it helps in the debugging process, this was the initial non-Safe Mode stack trace that I saw:

At Cannot read property 'length' of undefined

TypeError: Cannot read property 'length' of undefined
    at DisplayLayer.updateSpatialIndex (C:/temp/atom/out/Atom x64/resources/app/node_modules/text-buffer/lib/display-layer.js:982:46)
    at DisplayLayer.populateSpatialIndexIfNeeded (C:/temp/atom/out/Atom x64/resources/app/node_modules/text-buffer/lib/display-layer.js:1069:18)
    at DisplayLayer.getScreenLineCount (C:/temp/atom/out/Atom x64/resources/app/node_modules/text-buffer/lib/display-layer.js:617:16)
    at TextEditor.getScreenLineCount (C:/temp/atom/out/Atom x64/resources/app/src/text-editor.js:1217:58)
    at Minimap.getHeight (/packages/minimap/lib/minimap.js:616:28)
    at Minimap.getMaxScrollTop (/packages/minimap/lib/minimap.js:943:29)
    at Minimap.getScrollTopFromEditor (/packages/minimap/lib/minimap.js:933:51)
    at Minimap.getScrollTop (/packages/minimap/lib/minimap.js:883:14)
    at Minimap.getLastVisibleScreenRow (/packages/minimap/lib/minimap.js:861:13)
    at Minimap.emitRangeChanges (/packages/minimap/lib/mixins/decoration-management.js:504:38)
    at Minimap.emitDecorationChanges (/packages/minimap/lib/mixins/decoration-management.js:489:10)
    at Minimap.decorateMarker (/packages/minimap/lib/mixins/decoration-management.js:422:10)
    at MinimapSelectionView.module.exports.MinimapSelectionView.handleSelection (/packages/minimap-selection/lib/minimap-selection-view.coffee:32:31)
    at /packages/minimap-selection/lib/minimap-selection-view.coffee:1:1
    at Config.observeKeyPath (C:/temp/atom/out/Atom x64/resources/app/src/config.js:1056:11)
    at Config.observe (C:/temp/atom/out/Atom x64/resources/app/src/config.js:485:25)
    at /packages/minimap-selection/lib/minimap-selection-view.coffee:15:36)
    at /packages/minimap-selection/lib/minimap-selection.coffee:35:23
    at editorsMinimaps.forEach (/packages/minimap/lib/main.js:378:51)
    at Map.forEach (native)
    at Main.observeMinimaps (/packages/minimap/lib/main.js:378:28)
    at Object.activatePlugin (/packages/minimap-selection/lib/minimap-selection.coffee:33:30)
    at Main.activatePlugin (/packages/minimap/lib/mixins/plugin-management.js:187:12)
    at Main.updatesPluginActivationState (/packages/minimap/lib/mixins/plugin-management.js:171:14)
    at /packages/minimap/lib/mixins/plugin-management.js:241:12)
    at Config.observeKeyPath (C:/temp/atom/out/Atom x64/resources/app/src/config.js:1056:11)
    at Config.observe (C:/temp/atom/out/Atom x64/resources/app/src/config.js:485:25)
    at Main.registerPluginControls (/packages/minimap/lib/mixins/plugin-management.js:240:53)
    at Main.registerPlugin (/packages/minimap/lib/mixins/plugin-management.js:83:12)
    at Object.consumeMinimapServiceV1 (/packages/minimap-selection/lib/minimap-selection.coffee:21:14)
    at Provider.module.exports.Provider.provide (C:/temp/atom/out/Atom x64/resources/app/node_modules/service-hub/lib/provider.js:34:58)
    at ServiceHub.module.exports.ServiceHub.consume (C:/temp/atom/out/Atom x64/resources/app/node_modules/service-hub/lib/service-hub.js:50:24)
    at Package.activateServices (C:/temp/atom/out/Atom x64/resources/app/src/package.js:405:79)
    at Package.activateNow (C:/temp/atom/out/Atom x64/resources/app/src/package.js:233:20)
    at measure (C:/temp/atom/out/Atom x64/resources/app/src/package.js:206:33)
    at Package.measure (C:/temp/atom/out/Atom x64/resources/app/src/package.js:88:25)