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:
Jerry.Kirk%Nexwarecorp.com 2000-11-08 13:54:15 +00:00
Родитель 49ab1ee935
Коммит 4a2bfa50ee
1 изменённых файлов: 15 добавлений и 15 удалений

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

@ -214,10 +214,14 @@ nsTimerPh::Cancel()
int nsTimerPh::TimerEventHandler( void *aData, pid_t aRcvId, void *aMsg, size_t aMsgLen )
{
int localTimerId;
nsTimerPh* timer = (nsTimerPh *)aData;
if( timer )
{
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 )
@ -229,10 +233,6 @@ int nsTimerPh::TimerEventHandler( void *aData, pid_t aRcvId, void *aMsg, size_t
timer->mCallback->Notify( timer );
}
/* These stupid people destroy this object inside the callback */
/* so don't do anything with it from here on */
}
return Pt_CONTINUE;
}