Merge "Fix NPE when IMM#invalidateInput() is called too early" into tm-dev