Closed
Bug 65616
Opened 24 years ago
Closed 24 years ago
pref observers do not support multiple observers per domain
Categories
(Core :: Preferences: Backend, defect, P2)
Tracking
()
VERIFIED
FIXED
mozilla0.8
People
(Reporter: alecf, Assigned: alecf)
References
Details
(Keywords: crash, Whiteboard: fix in hand)
Attachments
(2 files)
3.90 KB,
patch
|
Details | Diff | Splinter Review | |
4.90 KB,
patch
|
Details | Diff | Splinter Review |
The pref observer system gets really confused if you try to add multiple observers on the same domain. i.e. if from JS you say: pref.addObserver("browser.toolbar.showbuttons", foo); pref.addObserver("browser.toolbar.showbuttons", bar); then the backend gets all confused because the mObservers hashtable throws out it's reference to "foo" but keeps a pointer to it as a callback. I have a fix, patch forthcoming. Looking for reviewers, super reviewers
Comment 2•24 years ago
|
||
Carrying over keywords from bug 62935 where there is a little more detail. I closed that one in favor of this because you seem hot on the trail of a fix and it was just middle-of-the-pile for me.
Assignee | ||
Comment 3•24 years ago
|
||
Assignee | ||
Comment 4•24 years ago
|
||
so what I'm doing now is keeping two arrays, mObservers, and mObserverDomains, which must be maintained in lock-step. mObservers keeps a refcount to each observer, and mObserverDomains keeps the domain that they were registered with. This is so that we can unregister all the domains in unregisterObservers() I just realized that the patch is slightly dangerous if you have the same observer observing two domains, and you remove one of them. new patch forthcoming which walks the observer list, looking for an exact match
Status: NEW → ASSIGNED
OS: Windows 2000 → All
Priority: -- → P2
Target Milestone: --- → mozilla0.8
Assignee | ||
Comment 5•24 years ago
|
||
Assignee | ||
Comment 6•24 years ago
|
||
adding dveditz to CC for review, blizzard and bryner for possible super reviews
Comment 7•24 years ago
|
||
thanks, but i'm not a super-reviewer :)
nsPref* nsPref::gInstance = NULL; could we make this nsnull? +nsresult +nsPref::unregisterObservers() + PRUint32 i; + for (i=0; i< count; i++) { is there any reason for i to survive the for loop? i suppose parallelism to +NS_IMETHODIMP nsPref::RemoveObserver(const char *aDomain, + nsIObserver *aObserver) however, if that's the case then you have two styles for function definitions: returntype\nfunctiondef and returntype\sfunctiondef otherwise this code looks good.
Assignee | ||
Comment 9•24 years ago
|
||
the reason for the for() syntax as it is is because certain different compilers scope for (PRInt32 i=0;...) differently
Assignee | ||
Updated•24 years ago
|
Whiteboard: fix in hand
Assignee | ||
Comment 10•24 years ago
|
||
got an sr from blizzard... thanks! fix is in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 11•24 years ago
|
||
other than checking lxr to confirm alecf's changes to nsPref.cpp, am giving this a rubberstamp...
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•