Revision: 4499
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4499&view=rev
Author:   dcommander
Date:     2011-06-15 02:09:59 +0000 (Wed, 15 Jun 2011)

Log Message:
-----------
Attempt to fix 3305357 (Enabling custom compression level on client crashes 
server)

Modified Paths:
--------------
    branches/1_1/common/rdr/ZlibOutStream.cxx

Modified: branches/1_1/common/rdr/ZlibOutStream.cxx
===================================================================
--- branches/1_1/common/rdr/ZlibOutStream.cxx   2011-06-14 22:25:30 UTC (rev 
4498)
+++ branches/1_1/common/rdr/ZlibOutStream.cxx   2011-06-15 02:09:59 UTC (rev 
4499)
@@ -88,8 +88,6 @@
 //        fprintf(stderr,"zos flush: calling deflate, avail_in %d, avail_out 
%d\n",
 //                zs->avail_in,zs->avail_out);
       checkCompressionLevel();
-      int rc = deflate(zs, Z_SYNC_FLUSH);
-      if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed");
 
 //        fprintf(stderr,"zos flush: after deflate: %d bytes\n",
 //                zs->next_out-underlying->getptr());
@@ -122,8 +120,6 @@
 //                zs->avail_in,zs->avail_out);
 
       checkCompressionLevel();
-      int rc = deflate(zs, 0);
-      if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed");
 
 //        fprintf(stderr,"zos overrun: after deflate: %d bytes\n",
 //                zs->next_out-underlying->getptr());
@@ -155,9 +151,15 @@
 void ZlibOutStream::checkCompressionLevel()
 {
   if (newLevel != compressionLevel) {
-    if (deflateParams (zs, newLevel, Z_DEFAULT_STRATEGY) != Z_OK) {
+    int rc = deflate(zs, Z_SYNC_FLUSH);
+    if (rc != Z_OK) 
+      throw Exception("ZlibOutStream: deflate failed");
+    if (deflateParams (zs, newLevel, Z_DEFAULT_STRATEGY) != Z_OK)
       throw Exception("ZlibOutStream: deflateParams failed");
-    }
     compressionLevel = newLevel;
+  } else {
+    int rc = deflate(zs, Z_SYNC_FLUSH);
+    if (rc != Z_OK) 
+      throw Exception("ZlibOutStream: deflate failed");
   }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to