Advertisement

Crash on class copy, 2.16.0

Started by April 06, 2009 03:37 AM
1 comment, last by WitchLord 15 years, 7 months ago
Application crash. 2.16.0, WinXP x86. Reproduce:

class Some
{
    int[] i; // need be array
}

void main()
{
    Some e;
    e=some(e); // crash
}

Some@ some(Some@ e)
{
    return e;
}

Thanks for the report.

To fix this, just add a check in the asCArrayObject::operator= method to return without doing anything if the other argument is the same as this object.

asCArrayObject &asCArrayObject::operator=(asCArrayObject &other){	if( &other != this ) 	{		if( buffer )		{			DeleteBuffer(buffer);			buffer = 0;		}		// Copy all elements from the other array		CreateBuffer(&buffer, other.buffer->numElements);		CopyBuffer(buffer, other.buffer);		}	return *this;}


Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
I've checked in the fix now.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement