fixes bug 279852 "nsWeakReference not threadsafe assertions due to TimerThread::Init" r=sfraser sr=bryner

This commit is contained in:
darin%meer.net 2005-03-14 06:37:01 +00:00
Родитель 211c887f78
Коммит 226a6d53db
2 изменённых файлов: 5 добавлений и 14 удалений

Просмотреть файл

@ -47,7 +47,7 @@
#include "nsIObserverService.h"
#include "nsIServiceManager.h"
NS_IMPL_THREADSAFE_ISUPPORTS3(TimerThread, nsIRunnable, nsISupportsWeakReference, nsIObserver)
NS_IMPL_THREADSAFE_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver)
TimerThread::TimerThread() :
mInitInProgress(0),
@ -77,13 +77,6 @@ TimerThread::~TimerThread()
nsTimerImpl *timer = NS_STATIC_CAST(nsTimerImpl *, mTimers[n]);
NS_RELEASE(timer);
}
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
observerService->RemoveObserver(this, "sleep_notification");
observerService->RemoveObserver(this, "wake_notification");
}
}
nsresult
@ -131,8 +124,9 @@ nsresult TimerThread::Init()
mThread = nsnull;
}
else {
observerService->AddObserver(this, "sleep_notification", PR_TRUE);
observerService->AddObserver(this, "wake_notification", PR_TRUE);
// We'll be released at xpcom shutdown
observerService->AddObserver(this, "sleep_notification", PR_FALSE);
observerService->AddObserver(this, "wake_notification", PR_FALSE);
}
}
}

Просмотреть файл

@ -41,8 +41,6 @@
#ifndef TimerThread_h___
#define TimerThread_h___
#include "nsWeakReference.h"
#include "nsIEventQueueService.h"
#include "nsIObserver.h"
#include "nsIRunnable.h"
@ -56,8 +54,7 @@
#include "prinrval.h"
#include "prlock.h"
class TimerThread : public nsSupportsWeakReference,
public nsIRunnable,
class TimerThread : public nsIRunnable,
public nsIObserver
{
public: