Workaround for hanging events. Fixes #4804 Upstream-commit: dece260f3aef2c98c95f3f06ff5ffbf1da3b1f39 Component: engine