Closed Bug 31491 Opened 25 years ago Closed 24 years ago

import needs nsAddrBookSession and nsAddrBookDatabase to be threadsafe

Categories

(SeaMonkey :: MailNews: Address Book & Contacts, defect, P3)

All
Other
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: tonyr, Assigned: chuang)

Details

Import get's tons of assertions in these objects from the new nsISupports 
threadsafe stuff.  nsAddrBookSession is called via proxy but it's ISupports 
interfaces need to be threadsafe.  The database is not always called through 
proxy although it could be if necessary?  In any case, the ISupports interfaces 
need to be threadsafe so I can create the object (and proxy if needed) from 
another thread.  Here are the diffs from changes I made to get rid of the 
assertions:
Index: mailnews/addrbook/src/nsAddrBookSession.cpp
===================================================================
RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAddrBookSession.cpp,v
retrieving revision 1.6
diff -r1.6 nsAddrBookSession.cpp
35c35
< NS_IMPL_ISUPPORTS(nsAddrBookSession, NS_GET_IID(nsIAddrBookSession));
---
> NS_IMPL_THREADSAFE_ISUPPORTS(nsAddrBookSession, NS_GET_IID
(nsIAddrBookSession));
Index: mailnews/addrbook/src/nsAddrDatabase.cpp
===================================================================
RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp,v
retrieving revision 1.45
diff -r1.45 nsAddrDatabase.cpp
219c219
< NS_IMPL_ADDREF(nsAddrDatabase)
---
> NS_IMPL_THREADSAFE_ADDREF(nsAddrDatabase)
224c224,226
< 	if (--mRefCnt == 0)	// OK, the cache is no longer holding onto 
this, so we really want to delete it, 
---
> 	nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
> 	NS_LOG_RELEASE(this, count,"nsAddrDatabase"); 
> 	if (count == 0)	// OK, the cache is no longer holding onto this, so we 
really want to delete it, 
225a228
> 		mRefCnt = 1; /* stabilize */
232,233c235
< 	NS_LOG_RELEASE(this, mRefCnt,"nsAddrDatabase"); 
< 	return mRefCnt;                                      
---
> 	return count;
Status: NEW → ASSIGNED
Target Milestone: M15
Code checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Per Esther, assign white box bug to her.
QA Contact: lchiang → esther
Candice, can you provide steps to test this. 
If you can get a debug build to see the console window,  no assertions in Import 
should mean it's fixed.
With Suresh's help using debug build (winnt) on 3/2/01 this is fixed. Verified
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.