don't swap iterators when swapping DB contents

Former-commit-id: 4971518d42218a63cf86919e91af54462f6dc8c0
This commit is contained in:
John Sully 2020-04-21 21:38:24 -04:00
parent 5a23a6da76
commit bd26d8bad7

View File

@ -186,11 +186,15 @@ int dictMerge(dict *dst, dict *src)
if (dictSize(dst) == 0) if (dictSize(dst) == 0)
{ {
std::swap(*dst, *src); std::swap(*dst, *src);
std::swap(dst->iterators, src->iterators);
return DICT_OK; return DICT_OK;
} }
if (dictSize(src) > dictSize(dst)) if (dictSize(src) > dictSize(dst))
{
std::swap(*dst, *src); std::swap(*dst, *src);
std::swap(dst->iterators, src->iterators);
}
if (!dictIsRehashing(dst) && !dictIsRehashing(src)) if (!dictIsRehashing(dst) && !dictIsRehashing(src))
{ {