Merge pull request #18121 from Crazy-P/Resolves-Freeze-on-change-reflection-probe

Resolves editor freezes on change of reflection probe
This commit is contained in:
Juan Linietsky 2018-05-07 15:39:25 -03:00 committed by GitHub
commit 3f3b4703e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 18 deletions

View File

@ -39,6 +39,7 @@ public:
class List { class List {
SelfList<T> *_first; SelfList<T> *_first;
SelfList<T> *_last;
public: public:
void add(SelfList<T> *p_elem) { void add(SelfList<T> *p_elem) {
@ -48,47 +49,54 @@ public:
p_elem->_root = this; p_elem->_root = this;
p_elem->_next = _first; p_elem->_next = _first;
p_elem->_prev = NULL; p_elem->_prev = NULL;
if (_first)
if (_first) {
_first->_prev = p_elem; _first->_prev = p_elem;
} else {
_last = p_elem;
}
_first = p_elem; _first = p_elem;
} }
void add_last(SelfList<T> *p_elem) { void add_last(SelfList<T> *p_elem) {
ERR_FAIL_COND(p_elem->_root); ERR_FAIL_COND(p_elem->_root);
if (!_first) {
add(p_elem);
return;
}
SelfList<T> *e = _first;
while (e->next()) {
e = e->next();
}
e->_next = p_elem;
p_elem->_prev = e->_next;
p_elem->_root = this; p_elem->_root = this;
p_elem->_next = NULL;
p_elem->_prev = _last;
if (_last) {
_last->_next = p_elem;
} else {
_first = p_elem;
}
_last = p_elem;
} }
void remove(SelfList<T> *p_elem) { void remove(SelfList<T> *p_elem) {
ERR_FAIL_COND(p_elem->_root != this); ERR_FAIL_COND(p_elem->_root != this);
if (p_elem->_next) { if (p_elem->_next) {
p_elem->_next->_prev = p_elem->_prev; p_elem->_next->_prev = p_elem->_prev;
} }
if (p_elem->_prev) {
if (p_elem->_prev) {
p_elem->_prev->_next = p_elem->_next; p_elem->_prev->_next = p_elem->_next;
} }
if (_first == p_elem) { if (_first == p_elem) {
_first = p_elem->_next; _first = p_elem->_next;
} }
if (_last == p_elem) {
_last = p_elem->_prev;
}
p_elem->_next = NULL; p_elem->_next = NULL;
p_elem->_prev = NULL; p_elem->_prev = NULL;
p_elem->_root = NULL; p_elem->_root = NULL;
@ -96,7 +104,10 @@ public:
_FORCE_INLINE_ SelfList<T> *first() { return _first; } _FORCE_INLINE_ SelfList<T> *first() { return _first; }
_FORCE_INLINE_ const SelfList<T> *first() const { return _first; } _FORCE_INLINE_ const SelfList<T> *first() const { return _first; }
_FORCE_INLINE_ List() { _first = NULL; } _FORCE_INLINE_ List() {
_first = NULL;
_last = NULL;
}
_FORCE_INLINE_ ~List() { ERR_FAIL_COND(_first != NULL); } _FORCE_INLINE_ ~List() { ERR_FAIL_COND(_first != NULL); }
}; };