File tree 2 files changed +13
-9
lines changed 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -286,12 +286,14 @@ PLDHashTable::~PLDHashTable() {
286
286
return ;
287
287
}
288
288
289
- // Clear any remaining live entries.
290
- mEntryStore .ForEachSlot (Capacity (), mEntrySize , [&](const Slot& aSlot) {
291
- if (aSlot.IsLive ()) {
292
- mOps ->clearEntry (this , aSlot.ToEntry ());
293
- }
294
- });
289
+ // Clear any remaining live entries (if not trivially destructible).
290
+ if (mOps ->clearEntry ) {
291
+ mEntryStore .ForEachSlot (Capacity (), mEntrySize , [&](const Slot& aSlot) {
292
+ if (aSlot.IsLive ()) {
293
+ mOps ->clearEntry (this , aSlot.ToEntry ());
294
+ }
295
+ });
296
+ }
295
297
296
298
// Entry storage is freed last, by ~EntryStore().
297
299
}
@@ -566,9 +568,11 @@ void PLDHashTable::RawRemove(Slot& aSlot) {
566
568
MOZ_ASSERT (aSlot.IsLive ());
567
569
568
570
// Load keyHash first in case clearEntry() goofs it.
569
- PLDHashEntryHdr* entry = aSlot.ToEntry ();
570
571
PLDHashNumber keyHash = aSlot.KeyHash ();
571
- mOps ->clearEntry (this , entry);
572
+ if (mOps ->clearEntry ) {
573
+ PLDHashEntryHdr* entry = aSlot.ToEntry ();
574
+ mOps ->clearEntry (this , entry);
575
+ }
572
576
if (keyHash & kCollisionFlag ) {
573
577
aSlot.MarkRemoved ();
574
578
mRemovedCount ++;
Original file line number Diff line number Diff line change @@ -778,9 +778,9 @@ struct PLDHashTableOps {
778
778
PLDHashHashKey hashKey;
779
779
PLDHashMatchEntry matchEntry;
780
780
PLDHashMoveEntry moveEntry;
781
- PLDHashClearEntry clearEntry;
782
781
783
782
// Optional hooks start here. If null, these are not called.
783
+ PLDHashClearEntry clearEntry;
784
784
PLDHashInitEntry initEntry;
785
785
};
786
786
You can’t perform that action at this time.
0 commit comments