SHA256
1
0
forked from pool/tigervnc
tigervnc/tigervnc-clean-pressed-key-on-exit.patch
Stefan Dirsch 478a217a95 - tigervnc-1.9.0-199-005db35
* update to current git master in order to fix boo#1132901
>>>>>>> ./tigervnc.changes.r85a118aa653f1d42c31302a788064076

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/tigervnc?expand=0&rev=161
2019-04-20 09:56:35 +00:00

86 lines
2.5 KiB
Diff

Index: b/vncviewer/DesktopWindow.cxx
===================================================================
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -207,6 +207,8 @@ DesktopWindow::~DesktopWindow()
delete statsGraph;
+ delete viewport;
+
// FLTK automatically deletes all child widgets, so we shouldn't touch
// them ourselves here
}
Index: b/vncviewer/Viewport.cxx
===================================================================
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -189,6 +189,18 @@ Viewport::Viewport(int w, int h, const r
Viewport::~Viewport()
{
+ // Send release for every pressed key
+ for(DownMap::iterator iter = downKeySym.begin(); iter != downKeySym.end(); ++iter) {
+ try {
+ if (iter->first > 0xff)
+ cc->writer()->writeKeyEvent(iter->second, 0, false);
+ else
+ cc->writer()->writeKeyEvent(iter->second, iter->first, false);
+ } catch (rdr::Exception& e) {
+ // ignore
+ }
+ }
+
// Unregister all timeouts in case they get a change tro trigger
// again later when this object is already gone.
Fl::remove_timeout(handlePointerTimeout, this);
Index: b/vncviewer/vncviewer.cxx
===================================================================
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -107,6 +107,8 @@ static const char *about_text()
return buffer;
}
+static CConn *cc;
+
void exit_vncviewer(const char *error)
{
// Prioritise the first error we get as that is probably the most
@@ -177,6 +179,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(_("Termination signal %d has been received. TigerVNC Viewer will now exit."), sig);
+ 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);
}
@@ -587,6 +599,9 @@ int main(int argc, char** argv)
XkbSetDetectableAutoRepeat(fl_display, True, NULL);
#endif
+ fl_open_display();
+ XSetIOErrorHandler(CleanupXIOErrorHandler);
+
CSecurity::upg = &dlg;
#ifdef HAVE_GNUTLS
CSecurityTLS::msg = &dlg;
@@ -672,7 +687,7 @@ int main(int argc, char** argv)
#endif
}
- CConn *cc = new CConn(vncServerName, sock);
+ cc = new CConn(vncServerName, sock);
while (!exitMainloop)
run_mainloop();