Skip to content

ContextMenu: Fix callbacks

ivan tkachenko requested to merge work/ratijas/ctx-menu into master

Clean up target and spell checker only after callback

Cleaning up spell checker before executing callback code that relied on it being still there didn't go very well. Besides, as soon as spell checker is reset to null, menu items for each suggestion is destroyed, taking down their JavaScript context with them, so callback closures bound to (created in) such context would not be able to run properly anymore: object ids like root would suddenly turn into null, context properties would either become undefined or raise exception when accessed etc.


Wrap callback in a try-catch

Just in case, so that we don't have to trust all the actions to be well-behaved, which might be even more dangerous if we were to allow the menu to be extended with 3rd-party items.

Merge request reports