SHA256
1
0
forked from pool/tigervnc
tigervnc/tigervnc-clean-pressed-key-on-exit.patch
Stefan Dirsch d1b635504b Accepting request 209296 from home:michalsrb:branches:X11:XOrg
- tigervnc-clean-pressed-key-on-exit.patch
  * Send release events for pressed keys after X I/O error.
    (bnc#670448)
- Build debug symbols for vncviewer.

OBS-URL: https://build.opensuse.org/request/show/209296
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/tigervnc?expand=0&rev=6
2013-12-03 15:35:36 +00:00

80 lines
2.4 KiB
Diff

diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 40d08ae..7a571ec 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -186,6 +186,8 @@ DesktopWindow::~DesktopWindow()
OptionsDialog::removeCallback(handleOptions);
+ delete viewport;
+
// FLTK automatically deletes all child widgets, so we shouldn't touch
// them ourselves here
}
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index e308a63..41733f9 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -112,6 +112,11 @@ Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_)
Viewport::~Viewport()
{
+ // Send release for every pressed key
+ for(DownMap::iterator iter = downKeySym.begin(); iter != downKeySym.end(); ++iter) {
+ cc->writer()->keyEvent(iter->second, false);
+ }
+
// Unregister all timeouts in case they get a change tro trigger
// again later when this object is already gone.
Fl::remove_timeout(handleUpdateTimeout, this);
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index 37d63a6..5bb811d 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -83,6 +83,8 @@ char vncServerName[VNCSERVERNAMELEN] = { '\0' };
static bool exitMainloop = false;
static const char *exitError = NULL;
+static CConn *cc;
+
void exit_vncviewer(const char *error)
{
// Prioritise the first error we get as that is probably the most
@@ -110,6 +112,16 @@ static void CleanupSignalHandler(int sig)
// CleanupSignalHandler allows C++ object cleanup to happen because it calls
// exit() rather than the default which is to abort.
vlog.info("CleanupSignalHandler called");
+ delete cc;
+ exit(1);
+}
+
+static int CleanupXIOErrorHandler(Display *dpy)
+{
+ // CleanupSignalHandler allows C++ object cleanup to happen because it calls
+ // exit() rather than the default which is to abort.
+ vlog.info("XErrorHandler called");
+ delete cc;
exit(1);
}
@@ -384,6 +396,10 @@ int main(int argc, char** argv)
init_fltk();
+ fl_open_display();
+
+ XSetIOErrorHandler(CleanupXIOErrorHandler);
+
Configuration::enableViewerParams();
/* Load the default parameter settings */
@@ -484,7 +500,7 @@ int main(int argc, char** argv)
#endif
}
- CConn *cc = new CConn(vncServerName, sock);
+ cc = new CConn(vncServerName, sock);
while (!exitMainloop) {
int next_timer;