Call FatalError on fatal exceptions
diff --git a/unix/xserver/hw/vnc/XorgGlue.c b/unix/xserver/hw/vnc/XorgGlue.c
index 712ed6a..8c1e085 100644
--- a/unix/xserver/hw/vnc/XorgGlue.c
+++ b/unix/xserver/hw/vnc/XorgGlue.c
@@ -40,6 +40,18 @@
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 5cae860..63227ac 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 13248f9..081e7fe 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -436,7 +436,11 @@
void vncRefreshScreenLayout(int scrIdx)
{
- desktop[scrIdx]->refreshScreenLayout();
+ try {
+ desktop[scrIdx]->refreshScreenLayout();
+ } catch (rdr::Exception& e) {
+ vncFatalError("%s", e.str());
+ }
}
int vncOverrideParam(const char *nameAndValue)