Browse Source

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.
tags/v1.5.90
Pierre Ossman 8 years ago
parent
commit
1db732494b
3 changed files with 13 additions and 1 deletions
  1. 7
    1
      vncviewer/CConn.cxx
  2. 5
    0
      vncviewer/vncviewer.cxx
  3. 1
    0
      vncviewer/vncviewer.h

+ 7
- 1
vncviewer/CConn.cxx View File

@@ -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;

+ 5
- 0
vncviewer/vncviewer.cxx View File

@@ -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"));

+ 1
- 0
vncviewer/vncviewer.h View File

@@ -22,6 +22,7 @@
#define VNCSERVERNAMELEN 64

void exit_vncviewer(const char *error = NULL);
bool should_exit();
void about_vncviewer();

#endif

Loading…
Cancel
Save