summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-05-04 14:58:01 +0200
committerPierre Ossman <ossman@cendio.se>2018-05-29 16:44:48 +0200
commit621580d7a8d39ab7beac255d747af9fe6998063a (patch)
tree8c0dc27f6cfe96298f562e880cdf83e89b3dbfc2 /unix
parent559e8b885444de35f78598c59a36fd6bfc088592 (diff)
downloadtigervnc-621580d7a8d39ab7beac255d747af9fe6998063a.tar.gz
tigervnc-621580d7a8d39ab7beac255d747af9fe6998063a.zip
Proper cleanup on termination of Xvnc/libvnc.so
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/vncExt.c1
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc12
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/unix/xserver/hw/vnc/vncExt.c b/unix/xserver/hw/vnc/vncExt.c
index f7ba9fa8..fd65eab6 100644
--- a/unix/xserver/hw/vnc/vncExt.c
+++ b/unix/xserver/hw/vnc/vncExt.c
@@ -585,6 +585,7 @@ static int SProcVncExtDispatch(ClientPtr client)
static void vncResetProc(ExtensionEntry* extEntry)
{
+ vncExtensionClose();
}
static void vncClientStateChange(CallbackListPtr * l, void * d, void * p)
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index e4135b3c..d6f6b742 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -262,6 +262,18 @@ void vncExtensionInit(void)
vncRegisterBlockHandlers();
}
+void vncExtensionClose(void)
+{
+ try {
+ for (int scr = 0; scr < vncGetScreenCount(); scr++) {
+ delete desktop[scr];
+ desktop[scr] = NULL;
+ }
+ } catch (rdr::Exception& e) {
+ vncFatalError("vncExtInit: %s",e.str());
+ }
+}
+
void vncHandleSocketEvent(int fd, int scrIdx, int read, int write)
{
desktop[scrIdx]->handleSocketEvent(fd, read, write);
diff --git a/unix/xserver/hw/vnc/vncExtInit.h b/unix/xserver/hw/vnc/vncExtInit.h
index e8294340..9414723f 100644
--- a/unix/xserver/hw/vnc/vncExtInit.h
+++ b/unix/xserver/hw/vnc/vncExtInit.h
@@ -48,6 +48,7 @@ extern int vncFbstride[];
extern int vncInetdSock;
void vncExtensionInit(void);
+void vncExtensionClose(void);
void vncHandleSocketEvent(int fd, int scrIdx, int read, int write);
void vncCallBlockHandlers(int* timeout);