Both Array and Dictionary are always in shared mode (removed copy on write).

This commit is contained in:
Juan Linietsky 2017-01-11 08:53:31 -03:00
parent 57166cd292
commit e6583117df
17 changed files with 50 additions and 93 deletions

View file

@ -36,7 +36,6 @@ struct ArrayPrivate {
SafeRefCount refcount;
Vector<Variant> array;
bool shared;
};
void Array::_ref(const Array& p_from) const {
@ -54,20 +53,9 @@ void Array::_ref(const Array& p_from) const {
_unref();
if (_fp->shared) {
_p = p_from._p;
_p = p_from._p;
} else {
_p = memnew( ArrayPrivate );
_p->shared=false;
_p->refcount.init();
_p->array=_fp->array;
if (_fp->refcount.unref())
memdelete(_fp);
}
}
void Array::_unref() const {
@ -106,10 +94,6 @@ void Array::clear() {
_p->array.clear();
}
bool Array::is_shared() const {
return _p->shared;
}
bool Array::operator==(const Array& p_array) const {
@ -316,11 +300,11 @@ Array::Array(const Array& p_from) {
_ref(p_from);
}
Array::Array(bool p_shared) {
Array::Array() {
_p = memnew( ArrayPrivate );
_p->refcount.init();
_p->shared=p_shared;
}
Array::~Array() {