[Scummvm-cvs-logs] SF.net SVN: scummvm:[48398] scummvm/trunk/engines/saga/script.h

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Mar 25 00:19:27 CET 2010


Revision: 48398
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48398&view=rev
Author:   fingolfin
Date:     2010-03-24 23:19:27 +0000 (Wed, 24 Mar 2010)

Log Message:
-----------
SAGA: Fix ScriptThread::operator=; some tweaking

Modified Paths:
--------------
    scummvm/trunk/engines/saga/script.h

Modified: scummvm/trunk/engines/saga/script.h
===================================================================
--- scummvm/trunk/engines/saga/script.h	2010-03-24 21:39:26 UTC (rev 48397)
+++ scummvm/trunk/engines/saga/script.h	2010-03-24 23:19:27 UTC (rev 48398)
@@ -268,13 +268,13 @@
 
 	// copy constructor
 	ScriptThread(const ScriptThread& s) {
-		memcpy(this, &s, sizeof(*this));
-
 		// Verify that s doesn't have a non-zero _stackBuf, for else
 		// we would have to clone  that buffer, too, which we currently
 		// don't do. This case should never occur anyway, though (at
 		// least as long as the thread handling code does not change).
-		assert(!_stackBuf);
+		assert(!s._stackBuf);
+
+		memcpy(this, &s, sizeof(*this));
 	}
 
 	// assignment operator
@@ -282,14 +282,16 @@
 		if (this == &s)
 			return *this;
 
+		// Verify that s doesn't have a non-zero _stackBuf, for else
+		// we would have to clone that buffer, too, which we currently
+		// don't do. This case should never occur anyway, though (at
+		// least as long as the thread handling code does not change).
+		assert(!s._stackBuf);
+
 		free(_stackBuf);
 		memcpy(this, &s, sizeof(*this));
 
-		// Verify that s doesn't have a non-zero _stackBuf, for else
-		// we would have to clone  that buffer, too, which we currently
-		// don't do. This case should never occur anyway, though (at
-		// least as long as the thread handling code does not change).
-		assert(!_stackBuf);
+		return *this;
 	}
 
 	~ScriptThread() {


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




More information about the Scummvm-git-logs mailing list