[rkward-cvs] SF.net SVN: rkward-code:[4697] trunk/rkward/rkward/rbackend/rkwarddevice/ rkgraphicsdevice_protocol_shared.h

tfry at users.sf.net tfry at users.sf.net
Sun Apr 14 07:08:56 UTC 2013


Revision: 4697
          http://sourceforge.net/p/rkward/code/4697
Author:   tfry
Date:     2013-04-14 07:08:54 +0000 (Sun, 14 Apr 2013)
Log Message:
-----------
Try to fix initialization order.

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_protocol_shared.h

Modified: trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_protocol_shared.h
===================================================================
--- trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_protocol_shared.h	2013-04-13 21:39:25 UTC (rev 4696)
+++ trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_protocol_shared.h	2013-04-14 07:08:54 UTC (rev 4697)
@@ -105,7 +105,13 @@
  */
 class RKAsyncDataStreamHelper {
 public:
-	RKAsyncDataStreamHelper () : instream (&inbuffer, QIODevice::ReadOnly), outstream (&outbuffer, QIODevice::WriteOnly), auxstream (&auxbuffer, QIODevice::ReadWrite) {
+	RKAsyncDataStreamHelper () : 
+			auxbuffer(), 
+			inbuffer(),
+			outbuffer(),
+			auxstream (&auxbuffer, QIODevice::ReadWrite),
+			instream (&inbuffer, QIODevice::ReadOnly), 
+			outstream (&outbuffer, QIODevice::WriteOnly) {
 		device = 0;
 		expected_read_size = 0;
 	}
@@ -151,16 +157,17 @@
 	int inSize () const {
 		return inbuffer.size ();
 	}
-	
-	QDataStream instream;
-	QDataStream outstream;
 private:
 	QIODevice *device;
 	quint32 expected_read_size;
+	// NOTE: Order of declaration of the buffers and streams is important, as these are initialized during construction, and depend on each other
+	QByteArray auxbuffer;
 	QByteArray inbuffer;
 	QByteArray outbuffer;
-	QByteArray auxbuffer;
 	QDataStream auxstream;
+public:
+	QDataStream instream;
+	QDataStream outstream;
 };
 
 #endif





More information about the rkward-tracker mailing list