diff --git a/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp b/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp index 8dda54abbf1..ef4f9a5931a 100644 --- a/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp +++ b/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp @@ -22,6 +22,7 @@ */ #include "nsTimerGtk.h" +#include "nsCOMPtr.h" static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID); @@ -43,6 +44,9 @@ PRBool nsTimerGtk::FireTimeout() mTimerId = g_timeout_add_full(calc_priority(mPriority), mDelay, nsTimerExpired, this, NULL); } + + // because Notify can cause 'this' to get destroyed, we need to hold a ref + nsCOMPtr kungFuDeathGrip = this; if (mFunc != NULL) { (*mFunc)(this, mClosure);