@poczta.onet.pl (Kamil Jońca) writes:
> It looks like emacs without gtk behaves better - no hangs.
Yeah, this is a known issue with libgtk. It gets very confused by being
abruptly disconnected from an X server (including machine B's X server
in your scenario). Emacs is probably the only GTK-using application
that has the ability to attach to and detach from X servers, so don't
expect a fix. :-/
Emacs with ./configure --with-x-toolkit=no is very nice, and is fully
functional as an X application. It's particularly nice if, like many of
us here, you don't care about having a tool bar or menu bar.