fix #4524: invalidation of options menu must happen on the UI thread

This also fixes #4523.
Merge branch 'release' into upstream