summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2017-12-07 14:55:54 +0100
committerPierre Ossman <ossman@cendio.se>2017-12-07 14:55:54 +0100
commit3b03b43017106397e41ff364a516e814299d9e5b (patch)
tree938654865610aeebd762d13fe948f205229e0f71 /unix
parentcf647a33718f5dfffb4f4df3a7ae4235e83a4065 (diff)
downloadtigervnc-3b03b43017106397e41ff364a516e814299d9e5b.tar.gz
tigervnc-3b03b43017106397e41ff364a516e814299d9e5b.zip
Call FatalError on fatal exceptions
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/XorgGlue.c12
-rw-r--r--unix/xserver/hw/vnc/XorgGlue.h10
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc6
3 files changed, 27 insertions, 1 deletions
diff --git a/unix/xserver/hw/vnc/XorgGlue.c b/unix/xserver/hw/vnc/XorgGlue.c
index 712ed6af..8c1e0857 100644
--- a/unix/xserver/hw/vnc/XorgGlue.c
+++ b/unix/xserver/hw/vnc/XorgGlue.c
@@ -40,6 +40,18 @@ unsigned long vncGetServerGeneration(void)
return serverGeneration;
}
+void vncFatalError(const char *format, ...)
+{
+ va_list args;
+ char buffer[4096];
+
+ va_start(args, format);
+ vsnprintf(buffer, sizeof(buffer), format, args);
+ va_end(args);
+
+ FatalError("%s", buffer);
+}
+
int vncGetScreenCount(void)
{
return screenInfo.numScreens;
diff --git a/unix/xserver/hw/vnc/XorgGlue.h b/unix/xserver/hw/vnc/XorgGlue.h
index 5cae860a..63227ac3 100644
--- a/unix/xserver/hw/vnc/XorgGlue.h
+++ b/unix/xserver/hw/vnc/XorgGlue.h
@@ -24,9 +24,19 @@
extern "C" {
#endif
+#ifdef __GNUC__
+# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
+# define __noreturn_attr __attribute__((noreturn))
+#else
+# define __printf_attr(a, b)
+# define __noreturn_attr
+#endif // __GNUC__
+
const char *vncGetDisplay(void);
unsigned long vncGetServerGeneration(void);
+void vncFatalError(const char *format, ...) __printf_attr(1, 2) __noreturn_attr;
+
int vncGetScreenCount(void);
void vncGetScreenFormat(int scrIdx, int *depth, int *bpp,
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index 13248f91..081e7feb 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -436,7 +436,11 @@ void vncPostScreenResize(int scrIdx, int success, int width, int height)
void vncRefreshScreenLayout(int scrIdx)
{
- desktop[scrIdx]->refreshScreenLayout();
+ try {
+ desktop[scrIdx]->refreshScreenLayout();
+ } catch (rdr::Exception& e) {
+ vncFatalError("%s", e.str());
+ }
}
int vncOverrideParam(const char *nameAndValue)