diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index f07d8079255..7fa0d2f758b 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -909,6 +909,7 @@ nsWindow::~nsWindow() if (MouseTrailer::GetSingleton().GetMouseTrailerWindow() == this) { MouseTrailer::GetSingleton().DestroyTimer(); + MouseTrailer::GetSingleton().SetMouseTrailerWindow(nsnull); } // If the widget was released without calling Destroy() then the native @@ -1608,6 +1609,12 @@ NS_METHOD nsWindow::Destroy() nsBaseWidget::Destroy(); } + // get rid of any mouse trailer references to self + if (MouseTrailer::GetSingleton().GetMouseTrailerWindow() == this) { + MouseTrailer::GetSingleton().DestroyTimer(); + MouseTrailer::GetSingleton().SetMouseTrailerWindow(nsnull); + } + // just to be safe. If we're going away and for some reason we're still // the rollup widget, rollup and turn off capture. if ( this == gRollupWidget ) {