Calling editor.getSession().setMode('jsx)
, then quickly calling editor.destroy()
causes null getLength error
#5681
Labels
Describe the bug
I just upgraded from 1.1.9 to 1.36.5 and I am running into an issue with calling
editor.getSession().setMode
, then destroying with :editor.destroy()
It looks to me like their are race conditions within the event handling such that its not accounting for this scenario.
I am currently working around the issue by waiting 100ms before allowing a destroy() call to run. My tests were still sometimes even failing with a 60 ms delay.
Expected Behavior
Ideally, if it was safe to call setMode then quickly call destroy in 1.1.9, it would be safe to do so in 1.36.5
Current Behavior
I get an errorwhen calling destroy soon after calling setMode like with setMode ('jsx')
Reproduction Steps
set setMode to change the mode,
then quickly call editor.destory without any much delay (a 6ms to 100ms wait is required to avoid an event error)
Possible Solution
make setMode and destroy promise based so setMode can wait to return so it can be destroyed right after.
Additional Information/Context
No response
Ace Version / Browser / OS / Keyboard layout
1.36.5
The text was updated successfully, but these errors were encountered: