AnWeber / atom-htmltidy

Atom Package to tidy up HTML with HTML Tidy 5
MIT License
2 stars 1 forks source link

Uncaught Error: This TextEditor has been destroyed #7

Closed ghost closed 8 years ago

ghost commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.4.0 System: Mac OS X 10.11.2 Thrown From: atom-htmltidy package, v1.8.0

Stack Trace

Uncaught Error: This TextEditor has been destroyed

At /Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:790

Error: This TextEditor has been destroyed
    at DisplayBuffer.module.exports.DisplayBuffer.screenPositionForBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:790:15)
    at TextEditorMarker.module.exports.TextEditorMarker.getHeadScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor-marker.js:179:33)
    at Cursor.module.exports.Cursor.getScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:73:26)
    at Cursor.module.exports.Cursor.getScreenRange (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:685:20)
    at Cursor.module.exports.Cursor.autoscroll (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:690:51)
    at Cursor.module.exports.Cursor.changePosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:675:21)
    at Cursor.module.exports.Cursor.setBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:80:19)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1415:23
    at TextEditor.module.exports.TextEditor.moveCursors (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1652:9)
    at TextEditor.module.exports.TextEditor.setCursorBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1414:19)
    at setText (/Users/jeff/.atom/packages/atom-htmltidy/lib/init.js:287:31)
    at OnFormatFinished (/Users/jeff/.atom/packages/atom-htmltidy/lib/init.js:141:9)
    at /Users/jeff/.atom/packages/atom-htmltidy/lib/init.js:102:2
    at TidyWorker.<anonymous> (/Users/jeff/.atom/packages/atom-htmltidy/lib/tidywrapper.js:85:5)
    at emitNone (events.js:67:13)
    at TidyWorker.emit (events.js:166:7)
    at ChildProcess.<anonymous> (/Users/jeff/.atom/packages/atom-htmltidy/lib/tidywrapper.js:60:10)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

Commands

     -3:03.7.0 core:undo (atom-text-editor.editor.is-focused)
     -3:02.2.0 core:save (atom-text-editor.editor.is-focused)
     -3:00.3.0 core:backspace (atom-text-editor.editor.is-focused)
     -2:59.4.0 core:save (atom-text-editor.editor.is-focused)
     -2:58.3.0 core:undo (atom-text-editor.editor.is-focused)
  2x -0:06.5.0 editor:newline (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "whitespace"
    ]
  },
  "atom-htmltidy": {}
}

Installed Packages

# User
atom-htmltidy, v1.8.0

# Dev
No dev packages
AnWeber commented 8 years ago

thanks for the issue report. I will try to reproduce the issue.

AnWeber commented 8 years ago

I have got the error by closing the texteditor before the formatting is finished. After the formatting is finished, my extension tries to update the destroyed editor. The issue is fixed in 91dd25ae62f3556a55fe12a1182c791015465656