mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 5403: Release services properly
This commit is contained in:
parent
6871ed81a0
commit
c009be2a77
@ -490,13 +490,12 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
|
||||
// Notify observers that the form is being submitted.
|
||||
nsresult result = NS_OK;
|
||||
nsIObserverService* theObserverService = nsnull;
|
||||
result = nsServiceManager::GetService(NS_OBSERVERSERVICE_PROGID, nsIObserverService::GetIID(),
|
||||
(nsISupports**) &theObserverService, nsnull);
|
||||
if (NS_SUCCEEDED(result) && theObserverService){
|
||||
NS_WITH_SERVICE(nsIObserverService, service, NS_OBSERVERSERVICE_PROGID, &result);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
nsString theTopic(NS_FORMSUBMIT_SUBJECT);
|
||||
nsIEnumerator* theEnum;
|
||||
result = theObserverService->EnumerateObserverList(theTopic.GetUnicode(), &theEnum);
|
||||
result = service->EnumerateObserverList(theTopic.GetUnicode(), &theEnum);
|
||||
if (NS_SUCCEEDED(result) && theEnum){
|
||||
nsIFormSubmitObserver* formSubmitObserver;
|
||||
nsISupports *inst;
|
||||
@ -511,7 +510,6 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isURLEncoded) {
|
||||
ProcessAsURLEncoded(isPost, data, fcFrame);
|
||||
@ -838,7 +836,7 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
||||
(nsISupports **)&service2);
|
||||
if ((NS_OK == res2) && (nsnull != service2)) {
|
||||
service2->WALLET_OKToCapture(&OKToCapture, count, URLName);
|
||||
NS_RELEASE(service2);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service2);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -872,7 +870,7 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
||||
(nsISupports **)&service);
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
res = service->WALLET_Capture(doc, *names, *values, vcard);
|
||||
NS_RELEASE(service);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -921,7 +919,7 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
res = service->SI_RememberSignonData
|
||||
(URLName, (char**)name_array, (char**)value_array, (char**)type_array, value_cnt);
|
||||
NS_RELEASE(service);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
}
|
||||
while (value_cnt--) {
|
||||
PR_FREEIF(name_array[value_cnt]);
|
||||
|
@ -1173,7 +1173,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc
|
||||
char* nameString = name.ToNewCString();
|
||||
res = service->SI_RestoreSignonData(URLName, nameString, &valueString);
|
||||
delete[] nameString;
|
||||
NS_RELEASE(service);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
PR_FREEIF(URLName);
|
||||
if (valueString && *valueString) {
|
||||
value = valueString;
|
||||
|
@ -293,7 +293,7 @@ nsNativeTextControlFrame::PostCreateWidget(nsIPresContext* aPresContext,
|
||||
char* nameString = name.ToNewCString();
|
||||
res = service->SI_RestoreSignonData(URLName, nameString, &valueString);
|
||||
delete[] nameString;
|
||||
NS_RELEASE(service);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
PR_FREEIF(URLName);
|
||||
if (valueString && *valueString) {
|
||||
value = valueString;
|
||||
|
Loading…
Reference in New Issue
Block a user