Revision: 4582 http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4582&view=rev Author: ossman_ Date: 2011-07-12 16:56:34 +0000 (Tue, 12 Jul 2011)
Log Message: ----------- Destroy the main UI and connection objects before popping up the fatal error message. This avoids a lot of problems with recursion and trying to send events over a dead socket. Modified Paths: -------------- trunk/vncviewer/CConn.cxx trunk/vncviewer/vncviewer.cxx trunk/vncviewer/vncviewer.h Modified: trunk/vncviewer/CConn.cxx =================================================================== --- trunk/vncviewer/CConn.cxx 2011-07-12 16:10:16 UTC (rev 4581) +++ trunk/vncviewer/CConn.cxx 2011-07-12 16:56:34 UTC (rev 4582) @@ -198,8 +198,7 @@ exit_vncviewer(); } catch (rdr::Exception& e) { vlog.error(e.str()); - fl_alert(e.str()); - exit_vncviewer(); + exit_vncviewer(e.str()); } recursing = false; Modified: trunk/vncviewer/vncviewer.cxx =================================================================== --- trunk/vncviewer/vncviewer.cxx 2011-07-12 16:10:16 UTC (rev 4581) +++ trunk/vncviewer/vncviewer.cxx 2011-07-12 16:56:34 UTC (rev 4582) @@ -66,9 +66,15 @@ static char aboutText[1024]; static bool exitMainloop = false; +static const char *exitError = NULL; -void exit_vncviewer() +void exit_vncviewer(const char *error) { + // Prioritise the first error we get as that is probably the most + // relevant one. + if ((error != NULL) && (exitError == NULL)) + exitError = strdup(error); + exitMainloop = true; } @@ -267,7 +273,7 @@ return 1; } - CConn cc(vncServerName); + CConn *cc = new CConn(vncServerName); while (!exitMainloop) { int next_timer; @@ -282,5 +288,10 @@ } } + delete cc; + + if (exitError != NULL) + fl_alert(exitError); + return 0; } Modified: trunk/vncviewer/vncviewer.h =================================================================== --- trunk/vncviewer/vncviewer.h 2011-07-12 16:10:16 UTC (rev 4581) +++ trunk/vncviewer/vncviewer.h 2011-07-12 16:56:34 UTC (rev 4582) @@ -19,7 +19,7 @@ #ifndef __VNCVIEWER_H__ #define __VNCVIEWER_H__ -void exit_vncviewer(); +void exit_vncviewer(const char *error = NULL); void about_vncviewer(); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev _______________________________________________ Tigervnc-commits mailing list Tigervnc-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-commits