From 177bb07bf47d8345280f93324af04d4a46d81373 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Mon, 18 Nov 2002 04:44:30 +0000 Subject: [PATCH] Bug 155192 crash [@nsRDFResource::~nsRDFResource] if gRDFService wasn't created patch by tingley@sundell.net r=timeless sr=bz --- rdf/util/src/nsRDFResource.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rdf/util/src/nsRDFResource.cpp b/rdf/util/src/nsRDFResource.cpp index 359c34760a4..42eb64b02d7 100644 --- a/rdf/util/src/nsRDFResource.cpp +++ b/rdf/util/src/nsRDFResource.cpp @@ -68,15 +68,17 @@ nsRDFResource::~nsRDFResource(void) delete doomed; } - gRDFService->UnregisterResource(this); + if (mURI) { + gRDFService->UnregisterResource(this); - // N.B. that we need to free the URI *after* we un-cache the resource, - // due to the way that the resource manager is implemented. - nsCRT::free(mURI); + // N.B. that we need to free the URI *after* we un-cache the resource, + // due to the way that the resource manager is implemented. + nsCRT::free(mURI); - if (--gRDFServiceRefCnt == 0) { - nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService); - gRDFService = nsnull; + if (--gRDFServiceRefCnt == 0) { + nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService); + gRDFService = nsnull; + } } }