Bug 1663977 - Null out the parent pointer of SessionHistoryEntry objects if their parent dies. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D89629
This commit is contained in:
Peter Van der Beken 2020-09-09 16:49:59 +00:00
Родитель bce06045ad
Коммит 3038ffdea7
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -322,6 +322,13 @@ SessionHistoryEntry::SessionHistoryEntry(const SessionHistoryEntry& aEntry)
mID(aEntry.mID) {}
SessionHistoryEntry::~SessionHistoryEntry() {
// Null out the mParent pointers on all our kids.
for (nsISHEntry* entry : mChildren) {
if (entry) {
entry->SetParent(nullptr);
}
}
if (sLoadIdToEntry) {
sLoadIdToEntry->RemoveIf(
[this](auto& aIter) { return aIter.Data() == this; });