aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-03-24 23:19:27 +0000
committerMax Horn2010-03-24 23:19:27 +0000
commited6602502f0f9fc602276060b5dd6e65dcfd1fd0 (patch)
treeaee9165107218555d1cb0f6effdc72e7fce29e48
parent86c779bed8eb6e023cc7c281016580474304dc8b (diff)
downloadscummvm-rg350-ed6602502f0f9fc602276060b5dd6e65dcfd1fd0.tar.gz
scummvm-rg350-ed6602502f0f9fc602276060b5dd6e65dcfd1fd0.tar.bz2
scummvm-rg350-ed6602502f0f9fc602276060b5dd6e65dcfd1fd0.zip
SAGA: Fix ScriptThread::operator=; some tweaking
svn-id: r48398
-rw-r--r--engines/saga/script.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/engines/saga/script.h b/engines/saga/script.h
index ecc1d017bb..1ff1809e04 100644
--- a/engines/saga/script.h
+++ b/engines/saga/script.h
@@ -268,13 +268,13 @@ public:
// 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 @@ public:
if (this == &s)
return *this;
- 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
+ // 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);
+
+ free(_stackBuf);
+ memcpy(this, &s, sizeof(*this));
+
+ return *this;
}
~ScriptThread() {