mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 619797 - imgRequest::Init should manage observer more carefully, r+a=joedrew
This commit is contained in:
parent
eff574fdb4
commit
5d6d929c9e
@ -241,19 +241,15 @@ nsresult imgRequest::Init(nsIURI *aURI,
|
||||
|
||||
// Register our pref observer if it hasn't been done yet.
|
||||
if (NS_UNLIKELY(!gRegisteredPrefObserver)) {
|
||||
imgRequestPrefObserver *observer = new imgRequestPrefObserver();
|
||||
if (observer) {
|
||||
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (branch) {
|
||||
branch->AddObserver(DISCARD_PREF, observer, PR_FALSE);
|
||||
branch->AddObserver(DECODEONDRAW_PREF, observer, PR_FALSE);
|
||||
branch->AddObserver(DISCARD_TIMEOUT_PREF, observer, PR_FALSE);
|
||||
ReloadPrefs(branch);
|
||||
gRegisteredPrefObserver = PR_TRUE;
|
||||
}
|
||||
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (branch) {
|
||||
nsCOMPtr<nsIObserver> observer(new imgRequestPrefObserver());
|
||||
branch->AddObserver(DISCARD_PREF, observer, PR_FALSE);
|
||||
branch->AddObserver(DECODEONDRAW_PREF, observer, PR_FALSE);
|
||||
branch->AddObserver(DISCARD_TIMEOUT_PREF, observer, PR_FALSE);
|
||||
ReloadPrefs(branch);
|
||||
gRegisteredPrefObserver = PR_TRUE;
|
||||
}
|
||||
else
|
||||
delete observer;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user