Skip to content

Commit

Permalink
Make sure ensureHandlers is called _after_ plugin init in updatePlugins
Browse files Browse the repository at this point in the history
FIX: Fix a crash in plugin event handlers after dynamic reconfiguration.

See https://discuss.codemirror.net/t/errors-when-dynamically-adding-language-extension/7126
  • Loading branch information
marijnh committed Sep 22, 2023
1 parent bb36a97 commit a484959
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/editorview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,11 @@ export class EditorView {
for (let plugin of this.plugins) if (plugin.mustUpdate != update) plugin.destroy(this)
this.plugins = newPlugins
this.pluginMap.clear()
this.inputState.ensureHandlers(this.plugins)
} else {
for (let p of this.plugins) p.mustUpdate = update
}
for (let i = 0; i < this.plugins.length; i++) this.plugins[i].update(this)
if (prevSpecs != specs) this.inputState.ensureHandlers(this.plugins)
}

/// @internal
Expand Down

0 comments on commit a484959

Please sign in to comment.