Bug 899761 - Fix a debug-build shutdown crash in ContentParent. r=khuey

Sometimes a ContentParent object gets destroyed after XPCOM shutdown has
shut down the cycle collector.  If the ContentParent destructor releases
a cycle collected object (e.g. mMessageManager), this causes the cycle
collector to assert.
This commit is contained in:
Justin Lebar 2013-07-31 14:26:19 -07:00
Родитель 2847abff91
Коммит 32e25ae5f6
2 изменённых файлов: 11 добавлений и 0 удалений

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

@ -849,6 +849,13 @@ ContentParent::ShutDownProcess(bool aCloseWithError)
// NB: must MarkAsDead() here so that this isn't accidentally
// returned from Get*() while in the midst of shutdown.
MarkAsDead();
// A ContentParent object might not get freed until after XPCOM shutdown has
// shut down the cycle collector. But by then it's too late to release any
// CC'ed objects, so we need to null them out here, while we still can. See
// bug 899761.
mMemoryReporters.Clear();
mMessageManager = nullptr;
}
void

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

@ -430,6 +430,10 @@ private:
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
// If you add strong pointers to cycle collected objects here, be sure to
// release these objects in ShutDownProcess. See the comment there for more
// details.
GeckoChildProcessHost* mSubprocess;
base::ChildPrivileges mOSPrivileges;