diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 88ddc3a339c..e7a45ad7643 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1377,6 +1377,7 @@ public: GCGraphBuilder(GCGraph &aGraph, nsCycleCollectionLanguageRuntime **aRuntimes); ~GCGraphBuilder(); + bool Initialized(); PRUint32 Count() const { return mPtrToNodeMap.entryCount; } @@ -1430,6 +1431,12 @@ GCGraphBuilder::~GCGraphBuilder() PL_DHashTableFinish(&mPtrToNodeMap); } +bool +GCGraphBuilder::Initialized() +{ + return !!mPtrToNodeMap.ops; +} + PtrInfo* GCGraphBuilder::AddNode(void *s, nsCycleCollectionParticipant *aParticipant IF_DEBUG_CC_PARAM(PRUint32 aLangID) @@ -2581,6 +2588,8 @@ nsCycleCollector::BeginCollection() return PR_FALSE; GCGraphBuilder builder(mGraph, mRuntimes); + if (!builder.Initialized()) + return PR_FALSE; #ifdef COLLECT_TIME_DEBUG PRTime now = PR_Now();