Propagate exceptions from worker threads back to main thread
diff --git a/common/rfb/DecodeManager.h b/common/rfb/DecodeManager.h
index dec7a6c..fbb7f77 100644
--- a/common/rfb/DecodeManager.h
+++ b/common/rfb/DecodeManager.h
@@ -31,7 +31,10 @@
   class Mutex;
 }
 
-namespace rdr { class MemOutStream; }
+namespace rdr {
+  class Exception;
+  class MemOutStream;
+}
 
 namespace rfb {
   class CConnection;
@@ -50,6 +53,10 @@
     void flush();
 
   private:
+    void setThreadException(const rdr::Exception& e);
+    void throwThreadException();
+
+  private:
     CConnection *conn;
     Decoder *decoders[encodingMax+1];
 
@@ -90,6 +97,7 @@
     };
 
     std::list<DecodeThread*> threads;
+    rdr::Exception *threadException;
   };
 }