Closed Bug 499064 Opened 15 years ago Closed 15 years ago

need way for pending listener to know when a db has been opened

Categories

(MailNews Core :: Database, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b3

People

(Reporter: Bienvenu, Assigned: Bienvenu)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch wip (obsolete) — Splinter Review
Pending listeners are a handy way for listeners to deal with db's getting closed and re-opened, except that there's no way to know when the db has been opened. So I'm going to add a db change listener notification for when a pending listener becomes an actual listener.

I've also made nsMsgDBView use pending listeners, as a test case, and I believe asuth needs it anyway.

As a test, I faked out an imap uid validity roll and verified that the view gets told about the new database.

The attached patch works, but I need to clean it up a little - get rid of duplicate code, basically.
Attached patch patch for review (obsolete) — Splinter Review
Asking asuth for review since he knows the relevant code really well, and he needs the patch...
Attachment #383844 - Attachment is obsolete: true
Attachment #383942 - Flags: superreview?(bugzilla)
Attachment #383942 - Flags: review?(bugmail)
You never UnregisterPendingListener, yet the view somehow doesn't leak in the DBViewWrapper unit tests.  Is it getting cycle collected?
Attachment #383942 - Flags: review?(bugmail) → review+
Comment on attachment 383942 [details] [diff] [review]
patch for review

r=asuth with UnregisterPendingListener
good catch on the unregister pending listener...

I'm not sure why the unit test leak logs wouldn't have picked that up. We don't cycle collect.
Attachment #383942 - Attachment is obsolete: true
Attachment #384009 - Flags: superreview?(bugzilla)
Attachment #384009 - Flags: review+
Attachment #383942 - Flags: superreview?(bugzilla)
(In reply to comment #4)
> I'm not sure why the unit test leak logs wouldn't have picked that up. We don't
> cycle collect.

Yes we do: http://mxr.mozilla.org/comm-central/source/mailnews/test/resources/mailShutdown.js#34
Attachment #384009 - Flags: superreview?(bugzilla) → superreview+
Comment on attachment 384009 [details] [diff] [review]
unregister pending listener

>+    nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
>+    NS_ENSURE_SUCCESS(rv,rv);

nit: add a space after the comma please (2 places in this patch).

sr=Standard8 with that fixed.
fix checked in, with nits addressed.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
I meant to say that the db doesn't use the cycle collector, afaik.
Target Milestone: --- → Thunderbird 3.0b3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: