diff options
author | jsorg71 <jsorg71> | 2009-08-21 17:30:14 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2009-08-21 17:30:14 +0000 |
commit | c7838641cfb169bb09872ec676fb240db4846534 (patch) | |
tree | 13afe33b902aaf0301c02b9bea71d09517d4d24f /sesman/chansrv/clipboard.c | |
parent | 359a1908509f213372987c314b13e963bbb9961a (diff) | |
download | xrdp-proprietary-c7838641cfb169bb09872ec676fb240db4846534.tar.gz xrdp-proprietary-c7838641cfb169bb09872ec676fb240db4846534.zip |
handle X server crash better
Diffstat (limited to 'sesman/chansrv/clipboard.c')
-rw-r--r-- | sesman/chansrv/clipboard.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index d9dcd60d..00c13193 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -30,7 +30,6 @@ #include "os_calls.h" #include "chansrv.h" -static Display* g_display = 0; static Atom g_clipboard_atom = 0; static Atom g_clip_property_atom = 0; static Atom g_timestamp_atom = 0; @@ -45,7 +44,6 @@ static Window g_wnd = 0; static Screen* g_screen = 0; static int g_screen_num = 0; static int g_xfixes_event_base = 0; -static int g_sck_closed = 0; static int g_last_clip_size = 0; static char* g_last_clip_data = 0; @@ -55,6 +53,7 @@ static int g_got_selection = 0; /* boolean */ static Time g_selection_time = 0; extern int g_cliprdr_chan_id; /* in chansrv.c */ +extern Display* g_display; /*****************************************************************************/ /* returns time in miliseconds @@ -86,13 +85,6 @@ clipboard_init(void) return 0; } rv = 0; - g_sleep(500); - g_display = XOpenDisplay(0); - if (g_display == 0) - { - g_writeln("xrdp-chansrv: clipboard_init: XOpenDisplay failed"); - rv = 1; - } if (rv == 0) { g_x_socket = XConnectionNumber(g_display); @@ -185,17 +177,11 @@ clipboard_deinit(void) { return 0; } - if (!g_sck_closed) - { - g_delete_wait_obj_from_socket(g_x_wait_obj); - g_x_wait_obj = 0; - XDestroyWindow(g_display, g_wnd); - g_wnd = 0; - XCloseDisplay(g_display); - g_display = 0; - g_x_socket = 0; - g_sck_closed = 1; - } + 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_clip_up = 0; @@ -700,10 +686,6 @@ clipboard_get_wait_objs(tbus* objs, int* count, int* timeout) { return 0; } - if (g_sck_closed) - { - return 0; - } lcount = *count; objs[lcount] = g_x_wait_obj; lcount++; @@ -721,17 +703,12 @@ clipboard_check_wait_objs(void) { return 0; } - if (g_sck_closed) - { - return 0; - } if (g_is_wait_obj_set(g_x_wait_obj)) { if (XPending(g_display) < 1) { /* something is wrong, should not get here */ g_writeln("xrdp-chansrv: clipboard_check_wait_objs: sck closed"); - g_sck_closed = 1; return 0; } while (XPending(g_display) > 0) |