diff options
Diffstat (limited to 'engines/saga')
-rw-r--r-- | engines/saga/script.h | 18 |
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() { |