зеркало из https://github.com/mozilla/pjs.git
PHOTON ONLY: Added a Kung Foo Deathgrip to the Timer Event handler
so the timer could not be destroyed while inside the callback. I did it just like GTK did it. It was crashing at http://www.uescape.com
This commit is contained in:
Родитель
ef50758154
Коммит
cd780c84e0
|
@ -214,23 +214,23 @@ nsTimerPh::Cancel()
|
|||
int nsTimerPh::TimerEventHandler( void *aData, pid_t aRcvId, void *aMsg, size_t aMsgLen )
|
||||
{
|
||||
int localTimerId;
|
||||
|
||||
nsTimerPh* timer = (nsTimerPh *)aData;
|
||||
if( timer )
|
||||
{
|
||||
localTimerId = timer->mTimerId;
|
||||
|
||||
if( timer->mFunc != NULL )
|
||||
{
|
||||
(*timer->mFunc)( timer, timer->mClosure );
|
||||
}
|
||||
else if ( timer->mCallback != NULL )
|
||||
{
|
||||
timer->mCallback->Notify( timer );
|
||||
}
|
||||
|
||||
/* These stupid people destroy this object inside the callback */
|
||||
/* so don't do anything with it from here on */
|
||||
PR_LOG(PhTimLog, PR_LOG_DEBUG, ("nsTimerPh::TimerEventHandler this=<%p>\n", aData));
|
||||
NS_ASSERTION(timer, "nsTimerPh::TimerEventHandler is NULL!");
|
||||
|
||||
// because Notify can cause 'timer' to get destroyed, we need to hold a ref
|
||||
nsCOMPtr<nsITimer> kungFuDeathGrip = timer;
|
||||
|
||||
localTimerId = timer->mTimerId;
|
||||
|
||||
if( timer->mFunc != NULL )
|
||||
{
|
||||
(*timer->mFunc)( timer, timer->mClosure );
|
||||
}
|
||||
else if ( timer->mCallback != NULL )
|
||||
{
|
||||
timer->mCallback->Notify( timer );
|
||||
}
|
||||
|
||||
return Pt_CONTINUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче