1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tt: ensure ttsession is shut down properly.

This commit is contained in:
Liang Chang 2022-03-24 14:59:59 +00:00
parent 1ac963d735
commit 2e69f83d33
3 changed files with 18 additions and 9 deletions

View file

@ -67,7 +67,7 @@ static int parse_Xdisplay_string(_Tt_string display,
_Tt_string &hostname); _Tt_string &hostname);
jmp_buf _Tt_desktop::io_exception; sigjmp_buf _Tt_desktop::io_exception;
// The following private class data is declared and allocated here // The following private class data is declared and allocated here
// so that everybody that includes mp_desktop.h doesn't have to // so that everybody that includes mp_desktop.h doesn't have to
@ -161,7 +161,7 @@ init(_Tt_string dt_handle, _Tt_dt_type /* t */)
ret_val = 1; ret_val = 1;
int retries = 20; int retries = 20;
set_error_handler(_Tt_desktop::io_error_proc); set_error_handler(_Tt_desktop::io_error_proc);
if (0 == setjmp(io_exception)) { if (0 == sigsetjmp(io_exception, 1)) {
// now connect to the indicated X11 server // now connect to the indicated X11 server
while (retries--) { while (retries--) {
@ -185,7 +185,7 @@ init(_Tt_string dt_handle, _Tt_dt_type /* t */)
int _Tt_desktop:: int _Tt_desktop::
io_error_proc(void *) io_error_proc(void *)
{ {
longjmp(io_exception, 1); siglongjmp(io_exception, 1);
return(0); return(0);
} }
@ -215,7 +215,7 @@ close()
int ret_val = 1; int ret_val = 1;
set_error_handler(_Tt_desktop::io_error_proc); set_error_handler(_Tt_desktop::io_error_proc);
if (0 == setjmp(io_exception)) { if (0 == sigsetjmp(io_exception, 1)) {
// delete all properties set and close connection to desktop // delete all properties set and close connection to desktop
if (priv->xd != (Display *)0) { if (priv->xd != (Display *)0) {
@ -250,12 +250,23 @@ process_event()
XMappingEvent *xm; XMappingEvent *xm;
int pending; int pending;
int iostat; int iostat;
int ret_val = 1;
if (priv->xd == (Display *)0) { if (priv->xd == (Display *)0) {
return(0); return(0);
} }
CALLX11(XFlush)(priv->xd); set_error_handler(_Tt_desktop::io_error_proc);
if (0 == sigsetjmp(io_exception, 1)) {
CALLX11(XFlush)(priv->xd);
} else {
priv->xd = (Display *)0;
ret_val = 0;
}
restore_user_handler();
if (!ret_val) return(0);
xev.type = 0; xev.type = 0;
iostat=ioctl(notify_fd(), FIONREAD, (char *)&pending); iostat=ioctl(notify_fd(), FIONREAD, (char *)&pending);
if (iostat == -1 || pending == 0) { if (iostat == -1 || pending == 0) {

View file

@ -66,7 +66,7 @@ class _Tt_desktop : public _Tt_object {
void restore_user_handler(); void restore_user_handler();
static int io_error_proc(void *); static int io_error_proc(void *);
int *user_io_handler; int *user_io_handler;
static jmp_buf io_exception; static sigjmp_buf io_exception;
_Tt_desktop_private *priv; _Tt_desktop_private *priv;
}; };

View file

@ -87,9 +87,7 @@ _Tt_rpc_server::
~_Tt_rpc_server() ~_Tt_rpc_server()
{ {
#ifndef OPT_TLI #ifndef OPT_TLI
/* pmap_unset(_program, _version);
* pmap_unset(_program, _version);
*/
#else #else
for (int version = _version; version >= 1; version--) { for (int version = _version; version >= 1; version--) {
rpcb_unset(_program, version, (netconfig *)0); rpcb_unset(_program, version, (netconfig *)0);