Commit 09dd3c3b authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2090] Fix segfault

The (left|right)Rotate might have changed the parent, so it needs to be
reacquired after it.
parent be46391e
......@@ -1491,8 +1491,8 @@ RBTree<T>::insertRebalance(typename RBNode<T>::RBNodePtr* root,
} else {
if (node == parent->getRight()) {
node = parent;
parent = node->getParent();
leftRotate(root, node);
parent = node->getParent();
}
parent->color_ = RBNode<T>::BLACK;
parent->getParent()->color_ = RBNode<T>::RED;
......@@ -1508,8 +1508,8 @@ RBTree<T>::insertRebalance(typename RBNode<T>::RBNodePtr* root,
} else {
if (node == parent->getLeft()) {
node = parent;
parent = node->getParent();
rightRotate(root, node);
parent = node->getParent();
}
parent->color_ = RBNode<T>::BLACK;
parent->getParent()->color_ = RBNode<T>::RED;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment