tools: console: check if console was shutdown in callbacks
tools: console: check if console was shutdown in callbacks

On error in main thread virConsoleShutdown is called which
deletes fd watches/stream callback and yet callbacks can
be called after. Thus we can incorrectly allocate
terminalToStream.data memory and get memory leak for example.
Let's check if console was shutdown in the very beginning of
callbacks.

Reviewed-by: Cole Robinson <7cd45ff6ad1fb7cf556a02797d774247851499f8@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <7fa0e2698a05be944b362bdf5d7736c0162e16c9@virtuozzo.com>

fabianfreyer/libvirt,jardasgit/libvirt,andreabolognani/libvirt,eskultety/libvirt,andreabolognani/libvirt,olafhering/libvirt,eskultety/libvirt,jfehlig/libvirt,olafhering/libvirt,eskultety/libvirt,andreabolognani/libvirt,nertpinx/libvirt,crobinso/libvirt,jardasgit/libvirt,jfehlig/libvirt,andreabolognani/libvirt,libvirt/libvirt,jfehlig/libvirt,fabianfreyer/libvirt,andreabolognani/libvirt,nertpinx/libvirt,zippy2/libvirt,jfehlig/libvirt,crobinso/libvirt,libvirt/libvirt,jardasgit/libvirt,crobinso/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,olafhering/libvirt,olafhering/libvirt,eskultety/libvirt,zippy2/libvirt,eskultety/libvirt,crobinso/libvirt,nertpinx/libvirt,libvirt/libvirt,libvirt/libvirt,jardasgit/libvirt,zippy2/libvirt,zippy2/libvirt