mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Fixed containerValue allocation (mustn't allocate a new one)
This commit is contained in:
parent
73bc196592
commit
a3c65ef7e4
1 changed files with 12 additions and 9 deletions
|
@ -547,11 +547,18 @@ void ScriptVariable::ClearInternal()
|
|||
m_data.constArrayValue = NULL;
|
||||
break;
|
||||
|
||||
case VARIABLE_LISTENER:
|
||||
case VARIABLE_LISTENER:
|
||||
if (m_data.listenerValue) {
|
||||
delete m_data.listenerValue;
|
||||
m_data.listenerValue = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VARIABLE_SAFECONTAINER:
|
||||
if (m_data.listenerValue) {
|
||||
delete m_data.listenerValue;
|
||||
m_data.listenerValue = NULL;
|
||||
if (m_data.safeContainerValue) {
|
||||
delete m_data.safeContainerValue;
|
||||
m_data.safeContainerValue = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -970,7 +977,7 @@ void ScriptVariable::evalArrayAt(ScriptVariable& var)
|
|||
case VARIABLE_CONTAINER:
|
||||
index = var.intValue();
|
||||
|
||||
if (!index || index > m_data.constArrayValue->size) {
|
||||
if (!index || index > m_data.containerValue->NumObjects()) {
|
||||
throw ScriptException("array index %d out of range", index);
|
||||
}
|
||||
|
||||
|
@ -2053,10 +2060,6 @@ ScriptVariable& ScriptVariable::operator=(const ScriptVariable& variable)
|
|||
m_data.constArrayValue->refCount++;
|
||||
break;
|
||||
|
||||
case VARIABLE_CONTAINER:
|
||||
m_data.containerValue = new Container<SafePtr<Listener>>(*variable.m_data.containerValue);
|
||||
break;
|
||||
|
||||
case VARIABLE_SAFECONTAINER:
|
||||
m_data.safeContainerValue = new SafePtr<ConList>(*variable.m_data.safeContainerValue);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue