Sorry, I've just realized that this problem doesn't occur in gedit only. I have the same problem in Nautilus: if I click on a file to rename it and then press Alt or Ctrl, Nautilus freezes in the same way. It must be some shared library. Do you know which?