Fix race condition NPE in medium tests (#2148940)

Change-Id: I53a5fcb7eb4889da2cefa0fdc9092e44e57a2741
This commit is contained in:
Marc Blank 2009-09-27 20:55:22 -07:00
parent a4cc0006f1
commit e0aefba5fe

View File

@ -1397,12 +1397,14 @@ public class SyncManager extends Service implements Runnable {
if (mConnectivityReceiver != null) {
unregisterReceiver(mConnectivityReceiver);
}
ContentResolver resolver = getContentResolver();
resolver.unregisterContentObserver(mAccountObserver);
resolver.unregisterContentObserver(mMailboxObserver);
resolver.unregisterContentObserver(mSyncedMessageObserver);
resolver.unregisterContentObserver(mMessageObserver);
if (INSTANCE != null) {
ContentResolver resolver = getContentResolver();
resolver.unregisterContentObserver(mAccountObserver);
resolver.unregisterContentObserver(mMailboxObserver);
resolver.unregisterContentObserver(mSyncedMessageObserver);
resolver.unregisterContentObserver(mMessageObserver);
}
// Don't leak the Intent associated with this listener
if (mAccountsUpdatedListener != null) {
AccountManager.get(this).removeOnAccountsUpdatedListener(mAccountsUpdatedListener);