summaryrefslogtreecommitdiff
path: root/xpcom/glue
diff options
context:
space:
mode:
authorEric Rahm <erahm@mozilla.com>2018-04-09 11:01:59 -0700
committerwolfbeast <mcwerewolf@gmail.com>2018-04-19 12:06:04 +0200
commit9135a11e8c8f0837738fd976b28d36a53fd1de27 (patch)
tree9ed9a1f46f5d2e8373dcab553bad55b54bb8103b /xpcom/glue
parent3b4a81565780b724841c2950513416f14ab95ff3 (diff)
downloaduxp-9135a11e8c8f0837738fd976b28d36a53fd1de27.tar.gz
Bug 1452202 - Clean up PLDHashTable move operator. r=froydnj, a=RyanVM
--HG-- extra : source : 9036c64b7a66ffe93e717ca97642a4400e396d9c extra : intermediate-source : 041d1c561feb5f4d9bcd492f31f7203ca477f938
Diffstat (limited to 'xpcom/glue')
-rw-r--r--xpcom/glue/PLDHashTable.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/xpcom/glue/PLDHashTable.cpp b/xpcom/glue/PLDHashTable.cpp
index 6152e90003..5e932ccb2a 100644
--- a/xpcom/glue/PLDHashTable.cpp
+++ b/xpcom/glue/PLDHashTable.cpp
@@ -216,17 +216,17 @@ PLDHashTable::operator=(PLDHashTable&& aOther)
return *this;
}
- // Destruct |this|.
- this->~PLDHashTable();
-
- // |mOps| and |mEntrySize| are const so we can't assign them. Instead, we
- // require that they are equal. The justification for this is that they're
+ // |mOps| and |mEntrySize| are required to stay the same, they're
// conceptually part of the type -- indeed, if PLDHashTable was a templated
// type like nsTHashtable, they *would* be part of the type -- so it only
// makes sense to assign in cases where they match.
MOZ_RELEASE_ASSERT(mOps == aOther.mOps);
MOZ_RELEASE_ASSERT(mEntrySize == aOther.mEntrySize);
+ // Reconstruct |this|.
+ this->~PLDHashTable();
+ new (KnownNotNull, this) PLDHashTable(aOther.mOps, aOther.mEntrySize, 0);
+
// Move non-const pieces over.
mHashShift = Move(aOther.mHashShift);
mEntryCount = Move(aOther.mEntryCount);