Closed Bug 124208 Opened 23 years ago Closed 22 years ago

Address Book window shows LDAP directories from previous Profile in turbo mode

Categories

(MailNews Core :: LDAP Integration, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.0

People

(Reporter: yulian, Assigned: sspitzer)

References

Details

(Whiteboard: nab-ldap [adt2])

Attachments

(1 file, 5 obsolete files)

2002020703 Wins build on NT.

WIth new Profile to launch Address Book window, all the LDAP directories from
previous profile displayed in the Address Book Pane. Checking with
Preferences|Mail&Newsgroup|Addressing and Mail&Newsgroups Account
Settings|Addressing, there is no LDAP directory created yet for the new Profile.

Steps to reproduce:

1. Launch N6 & Address Book window with existing Profile
2. All the LDAP directories appear in the Address Book window
3. Exit N6
4. Launch Profile manager, create a new Profile and launch N6 with it
5. Launch Address Book window

Actual result: LDAP directories from previous Profile appear in the Address Book
  Window.

Expected result: No directory displayed in Address Book Window
Whiteboard: nab-ldap
are you using turbo?
Yes, if not using turbo, the problem is gone!
20020401 trunk builds
This problem still exists in trubo mode.
Summary: Address Book window shows LDAP directories from previous Profile → Address Book window shows LDAP directories from previous Profile in turbo mode
nominating for MachV, since QuickLaunch is on by default. cc law
Keywords: nsbeta1
reassigning to Cavin.
Assignee: sspitzer → cavin
Keywords: nsbeta1nsbeta1+
Whiteboard: nab-ldap → nab-ldap [adt2]
The addressbook service, as far as I know, is not observing profile changes. If
it's not, of course this will happen and it's probably fairly easy to fix. Also,
then it's my fault :-/ I could use suggestions with how to hook up the observer:
(1) What is the object that holds the addressbook data from the user profile?
(2) When it's time to internalize the data from the profile, is it done lazily
or at some defined moment?
taking.

I'll work with ccarlen on fixing how the addressbook works.

he's right, it's not observing profile changes at all.
Assignee: cavin → sspitzer
starting on this now.
Status: NEW → ASSIGNED
Whiteboard: nab-ldap [adt2] → nab-ldap [adt2] [starting on this, 4/16]
ok, the first problem is that nsDirPrefs caches the list of directories.

it needs to observe "profile-do-change", and reset state.

working on this now...
I've got an initial patch started that calls DIR_Shutdown() when the profiles 
change, and so when we relaunch, we re-get the prefs.

working on the asserts and kinks now.  I should have a patch for review by 
tomorrow.
Whiteboard: nab-ldap [adt2] [starting on this, 4/16] → nab-ldap [adt2] [ETA for patch 4/17]
Target Milestone: --- → mozilla1.0
Attachment #79643 - Attachment is obsolete: true
Attached patch latest patch. (obsolete) — Splinter Review
Attachment #79647 - Attachment is obsolete: true
Comment on attachment 79647 [details] [diff] [review]
same as before, with more comments.

> 
>-nsAbDirectoryDataSource::~nsAbDirectoryDataSource (void)
>+nsAbDirectoryDataSource::~nsAbDirectoryDataSource()
> {
>+  // release ourselves from the observer service
>+  nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
>+  if (observerService) {
>+    observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
>+    observerService->RemoveObserver(this, "profile-do-change");
>+  }
>+}

Since you're going to the effort to support weak refs and using that on the
call to AddObserver, what need is there to remove yourself as an observer in
the destructor?

The rest looks good - not that I'm that familiar with the code.

> 
>+
>+  rv = observerService->AddObserver(this, "profile-do-change", PR_TRUE);
>+  NS_ENSURE_SUCCESS(rv,rv);
>+
>+  rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
>+  NS_ENSURE_SUCCESS(rv,rv);
> 
>-	mInitialized = PR_TRUE;
> 	return NS_OK;
> }
> 
>-NS_IMPL_ISUPPORTS_INHERITED1(nsAbDirectoryDataSource, nsAbRDFDataSource, nsIAbListener)
>+NS_IMPL_ISUPPORTS_INHERITED3(nsAbDirectoryDataSource, nsAbRDFDataSource, nsIAbListener, nsIObserver, nsISupportsWeakReference)
>
Comment on attachment 79651 [details] [diff] [review]
latest patch.

r/sr = bienvenu - there are some changes that aren't needed to fix this bug in
the patch, and Seth is going  to make a more minimal patch for the branch.
Attachment #79651 - Flags: superreview+
>Since you're going to the effort to support weak refs and using that on the
>call to AddObserver, what need is there to remove yourself as an observer in
>the destructor?

nsObserverList::AddObserver() asserts if my observer does not support weak ref.

Is it our convention to use weak ref observers, and just add them, and not 
remove them?
> nsObserverList::AddObserver() asserts if my observer does not support weak ref.

Only if you pass TRUE as the last param to addObserver, right?

Is it our convention to use weak ref observers, and just add them, and not 
remove them?

Doing that cuts down on calls to getService() from destructors at shutdown time
(which will fail).

ccarlen, thanks for the info.  I've fixed the patch.
Comment on attachment 79670 [details] [diff] [review]
patch, don't call RemoveObserver() in the dtor, as per ccarlen's suggestion.  add a comment above the call to AddObserver(), fix some tabs / whitespace.

r=bienvenu
Attachment #79670 - Flags: review+
Whiteboard: nab-ldap [adt2] [ETA for patch 4/17] → nab-ldap [adt2] [have fix, have r=, waiting for sr=]
Comment on attachment 79670 [details] [diff] [review]
patch, don't call RemoveObserver() in the dtor, as per ccarlen's suggestion.  add a comment above the call to AddObserver(), fix some tabs / whitespace.

sr=mscott
Attachment #79670 - Flags: superreview+
*** Bug 134289 has been marked as a duplicate of this bug. ***
Whiteboard: nab-ldap [adt2] [have fix, have r=, waiting for sr=] → nab-ldap [adt2] [have fix, have r,sr, waiting to land]
Whiteboard: nab-ldap [adt2] [have fix, have r,sr, waiting to land] → nab-ldap [adt2] [fix in hand, have r=, sr=, will land on trunk today]
fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Keywords: adt1.0.0
Resolution: --- → FIXED
Whiteboard: nab-ldap [adt2] [fix in hand, have r=, sr=, will land on trunk today] → nab-ldap [adt2] [fixed on trunk]
Yulian - Can you verify this fix on the trunk today, and that no related
regressions occur?
20020419 Trunk build on Win2K

Verified.
20020419 Trunk build on WIns

The problem has been fixed.
Status: RESOLVED → VERIFIED
adding adt1.0.0+.  Please check into the branch as soon as possible and add
fixed1.0.0
Keywords: adt1.0.0adt1.0.0+
Has been checked into the branch yet? No keyword: fixed1.0.0
this has not been checked on the branch yet.  I'll do that today.
fixed on the branch as well.  setting fixed1.0.0
Keywords: adt1.0.0+fixed1.0.0
Whiteboard: nab-ldap [adt2] [fixed on trunk] → nab-ldap [adt2]
20020425 branch build on Wins

Verified in branch build
*** Bug 136274 has been marked as a duplicate of this bug. ***
20020603 branch build on Win2K

Verified with New Turbo Model. No regression.
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: