1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +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);
jmp_buf _Tt_desktop::io_exception;
sigjmp_buf _Tt_desktop::io_exception;
// The following private class data is declared and allocated here
// 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;
int retries = 20;
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
while (retries--) {
@ -185,7 +185,7 @@ init(_Tt_string dt_handle, _Tt_dt_type /* t */)
int _Tt_desktop::
io_error_proc(void *)
{
longjmp(io_exception, 1);
siglongjmp(io_exception, 1);
return(0);
}
@ -215,7 +215,7 @@ close()
int ret_val = 1;
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
if (priv->xd != (Display *)0) {
@ -250,12 +250,23 @@ process_event()
XMappingEvent *xm;
int pending;
int iostat;
int ret_val = 1;
if (priv->xd == (Display *)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;
iostat=ioctl(notify_fd(), FIONREAD, (char *)&pending);
if (iostat == -1 || pending == 0) {

View file

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

View file

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