From ed6602502f0f9fc602276060b5dd6e65dcfd1fd0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 24 Mar 2010 23:19:27 +0000 Subject: SAGA: Fix ScriptThread::operator=; some tweaking svn-id: r48398 --- engines/saga/script.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'engines/saga') 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() { -- cgit v1.2.3