Closed Bug 465985 Opened 16 years ago Closed 16 years ago

nsMessengerOSXIntegration registers for root folder changes twice

Categories

(MailNews Core :: Backend, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b1

People

(Reporter: humph, Assigned: humph)

Details

Attachments

(1 file, 2 obsolete files)

I've noticed that we get two BiffState notifications in the past, but as I was working on bug 465381 I saw that this is a more general problem.  Here's nsMessengerOSXIntegration::Init()

  // because we care if the default server changes                                                                                                                              
  rv = accountManager->AddRootFolderListener(this);
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);

  // because we care if the unread total count changes                                                                                                                          
  return mailSession->AddFolderListener(this, nsIFolderListener::boolPropertyChanged | nsIFolderListener::intPropertyChanged);

If I get rid of the call to accountManager->AddRootFolderListener(this), the problem goes away.  I think this is the case because when we biff on a folder, we pass back the root folder vs. the inbox, therefore we don't lose anything by not getting ItemInt changes from the account/root itself.

I notice that nsMessengerUnixIntegration doesn't have this duplication, but nsMessengerWinIntegration does, since you watch for the DefaultServerAtom in nsMessengerWinIntegration::OnItemBoolPropertyChanged.

I favour ripping out the AddRootFolderListener call, since I currently don't care if the server changes.  I'm not sure if I should, like Windows.  

Let me know and I'll do the patch.
On Windows, we do seem to care if the default server changes, because that causes us to do a bunch of things with registry keys where we store unread counts for the servers. I'm not sure why we care about the default server differently than we do for other servers, though.

I don't think MacOSX integration cares, like you say, so I think we can rip that out.
Attachment #349273 - Flags: superreview?(bugzilla)
Attachment #349273 - Flags: review?(bienvenu)
Attachment #349273 - Flags: review?(bienvenu) → review+
Comment on attachment 349273 [details] [diff] [review]
Removes first root folder listener

is it now the case that we don't have to include "nsIMsgAccountManager.h"?
Indeed, that can safely come out.  Thanks for spotting that.
Attachment #349273 - Attachment is obsolete: true
Attachment #349273 - Flags: superreview?(bugzilla)
Sorry, left in a comment.  This one is right.
Attachment #349337 - Attachment is obsolete: true
Attachment #349338 - Flags: superreview?(bugzilla)
Attachment #349338 - Flags: superreview?(bugzilla) → superreview+
Checked in: http://hg.mozilla.org/comm-central/rev/06aafa6c4646
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.0b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: