Fix memory leak in PluginEditorGrammar
(cherry picked from commit 70000f1493fa589827f2a854f3ab0814fdb39702)