diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 47f5a53c..47c87148 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -177,6 +177,13 @@ process_message_channel_setup(struct stream* s) int rv; struct chan_item* ci; + g_num_chan_items = 0; + g_cliprdr_index = -1; + g_rdpsnd_index = -1; + g_rdpdr_index = -1; + g_cliprdr_chan_id = -1; + g_rdpsnd_chan_id = -1; + g_rdpdr_chan_id = -1; LOG(10, ("process_message_channel_setup:")); in_uint16_le(s, num_chans); LOG(10, ("process_message_channel_setup: num_chans %d", num_chans)); @@ -449,6 +456,9 @@ channel_thread_loop(void* in_val) { LOG(0, ("channel_thread_loop: " "trans_check_wait_objs error resetting")); + clipboard_deinit(); + sound_deinit(); + dev_redir_deinit(); /* delete g_con_trans */ trans_delete(g_con_trans); g_con_trans = 0; diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index f7d4ee3f..b6ac73fe 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -142,6 +142,7 @@ clipboard_init(void) { return 0; } + clipboard_deinit(); rv = 0; /* setting the error handlers can cause problem when shutting down chansrv on some xlibs */ @@ -246,19 +247,27 @@ clipboard_init(void) int APP_CC clipboard_deinit(void) { - if (!g_clip_up) + if (g_x_wait_obj != 0) { - return 0; + g_delete_wait_obj_from_socket(g_x_wait_obj); + g_x_wait_obj = 0; + } + if (g_wnd != 0) + { + XDestroyWindow(g_display, g_wnd); + g_wnd = 0; } - g_delete_wait_obj_from_socket(g_x_wait_obj); - g_x_wait_obj = 0; - XDestroyWindow(g_display, g_wnd); - g_wnd = 0; g_x_socket = 0; g_free(g_last_clip_data); g_last_clip_data = 0; g_last_clip_size = 0; free_stream(g_ins); + g_ins = 0; + if (g_display != 0) + { + XCloseDisplay(g_display); + g_display = 0; + } g_clip_up = 0; return 0; }