channel-main: Don't close the file_stream if callbacks are pending
channel-main: Don't close the file_stream if callbacks are pending

If file_xfer_completed gets called while callbacks are pending we should
not call g_input_stream_close_async, because:
1) Doing so while another operation is pending on the file_stream will fail
2) Doing so while a non file_stream callback is pending may result in the
task being freed before the callback runs, resulting in a use after free.

This patch fixes this by setting a pending flag when any callbacks are
scheduled, and clearing it when it runs + checking for task->error
from all callbacks and if that is set call file_xfer_completed again.

Signed-off-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>

guodong/spice-gtk,freedesktop-unofficial-mirror/spice__spice-gtk,fgouget/spice-gtk,SPICE/spice-gtk,SPICE/spice-gtk,guodong/spice-gtk,flexVDI/spice-gtk,freedesktop-unofficial-mirror/spice__spice-gtk,Fantu/spice-gtk,elmarco/spice-gtk,Fantu/spice-gtk,freedesktop-unofficial-mirror/spice__spice-gtk,guodong/spice-gtk,SPICE/spice-gtk,Fantu/spice-gtk,guodong/spice-gtk,elmarco/spice-gtk,freedesktop-unofficial-mirror/spice__spice-gtk,elmarco/spice-gtk,fgouget/spice-gtk,SPICE/spice-gtk,elmarco/spice-gtk,flexVDI/spice-gtk,fgouget/spice-gtk,Fantu/spice-gtk