зеркало из https://github.com/mozilla/pjs.git
changing the static gRDFService to a local variable.
removing the gRefCnt code. this allows the three pane to work on Linux
This commit is contained in:
Родитель
1544099f8b
Коммит
75a64b0c93
|
@ -48,9 +48,6 @@ public:
|
|||
|
||||
protected:
|
||||
char* mURI;
|
||||
|
||||
static PRInt32 gRefCnt;
|
||||
static nsIRDFService* gRDFService;
|
||||
};
|
||||
|
||||
#endif // nsRDFResource_h__
|
||||
|
|
|
@ -29,38 +29,31 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
|||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PRInt32 nsRDFResource::gRefCnt = 0;
|
||||
nsIRDFService* nsRDFResource::gRDFService = nsnull;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsRDFResource::nsRDFResource(void)
|
||||
: mURI(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv = NS_OK;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**) &gRDFService);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
}
|
||||
}
|
||||
|
||||
nsRDFResource::~nsRDFResource(void)
|
||||
{
|
||||
gRDFService->UnregisterResource(this);
|
||||
nsIRDFService* rdfService = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**) &rdfService);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
|
||||
if (NS_SUCCEEDED(rv) && rdfService != nsnull) {
|
||||
rdfService->UnregisterResource(this);
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, rdfService);
|
||||
}
|
||||
|
||||
// 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.
|
||||
delete[] mURI;
|
||||
|
||||
if (--gRefCnt == 0) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
|
||||
gRDFService = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsRDFResource)
|
||||
|
@ -118,8 +111,24 @@ nsRDFResource::Init(const char* aURI)
|
|||
|
||||
PL_strcpy(mURI, aURI);
|
||||
|
||||
nsIRDFService* rdfService = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**) &rdfService);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
|
||||
if (!NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (rdfService == nsnull) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// don't replace an existing resource with the same URI automatically
|
||||
return gRDFService->RegisterResource(this, PR_TRUE);
|
||||
rv = rdfService->RegisterResource(this, PR_TRUE);
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, rdfService);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче