diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-09-23 12:20:32 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-09-23 12:20:32 +0200 |
commit | 1db732494b625df465797faaec3d76d535e69d43 (patch) | |
tree | c04da6ff9ccc49aab26f890d840327af9b4e94c8 | |
parent | d9b9003d977f8aaf37010c70bdac0b827749d554 (diff) | |
download | tigervnc-1db732494b625df465797faaec3d76d535e69d43.tar.gz tigervnc-1db732494b625df465797faaec3d76d535e69d43.zip |
Terminate the viewer even when waiting for data
It should be possible to exit the viewer even if the network has
stalled in the middle of a transfer.
-rw-r--r-- | vncviewer/CConn.cxx | 8 | ||||
-rw-r--r-- | vncviewer/vncviewer.cxx | 5 | ||||
-rw-r--r-- | vncviewer/vncviewer.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 2acb373e..686ce30d 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -240,6 +240,9 @@ void CConn::blockCallback() next_timer = INT_MAX; Fl::wait((double)next_timer / 1000.0); + + if (should_exit()) + throw rdr::Exception("Termination requested"); } void CConn::socketEvent(FL_SOCKET fd, void *data) @@ -267,7 +270,10 @@ void CConn::socketEvent(FL_SOCKET fd, void *data) exit_vncviewer(); } catch (rdr::Exception& e) { vlog.error("%s", e.str()); - exit_vncviewer(e.str()); + // Somebody might already have requested us to terminate, and + // might have already provided an error message. + if (!should_exit()) + exit_vncviewer(e.str()); } recursing = false; diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 4b989bb2..f9258b90 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -117,6 +117,11 @@ void exit_vncviewer(const char *error) exitMainloop = true; } +bool should_exit() +{ + return exitMainloop; +} + void about_vncviewer() { fl_message_title(_("About TigerVNC Viewer")); diff --git a/vncviewer/vncviewer.h b/vncviewer/vncviewer.h index 089fb270..4d0566bb 100644 --- a/vncviewer/vncviewer.h +++ b/vncviewer/vncviewer.h @@ -22,6 +22,7 @@ #define VNCSERVERNAMELEN 64 void exit_vncviewer(const char *error = NULL); +bool should_exit(); void about_vncviewer(); #endif |