Game Development Community

Torque 3D 1.1 Beta Criticial Fixes

by Rene Damm · in Torque 3D Professional · 02/20/2010 (8:29 am) · 1 replies

This is a thread for collecting critical source changes, mostly for crash bugs.

#1
02/20/2010 (8:31 am)

Copy-Sources In Object Instantiations Lead To Crashes


In simObject.h replace the declaration of "setCopySource" with

void setCopySource( SimObject* object );

In simObject.cpp add the following method:

void SimObject::setCopySource( SimObject* object )
{
   if( mCopySource )
      mCopySource->unregisterReference( &mCopySource );
   mCopySource = object;
   if( mCopySource )
      mCopySource->registerReference( &mCopySource );
}

In the same file, add the following lines to the SimObject::~SimObject destructor:

if( mCopySource )
      mCopySource->unregisterReference( &mCopySource );