Bug 381993: Crash [@ nsDOMMouseEvent::GetClientX] with mousemove generating and removing stuff. r=smaug, sr=roc.
authorsharparrow1@yahoo.com
Mon, 28 May 2007 21:56:16 -0700
changeset 1932 9a61fd3cfc83331eefffe77a2e42bdfcb3135b72
parent 1931 de3e897181c4f30b46a550d88bb4faf24e6138a1
child 1933 e819fefd776fcffb3e09f857227a58758d881ef8
push idunknown
push userunknown
push dateunknown
reviewerssmaug, roc
bugs381993
milestone1.9a5pre
Bug 381993: Crash [@ nsDOMMouseEvent::GetClientX] with mousemove generating and removing stuff. r=smaug, sr=roc.
dom/src/base/nsDOMWindowUtils.cpp
--- a/dom/src/base/nsDOMWindowUtils.cpp
+++ b/dom/src/base/nsDOMWindowUtils.cpp
@@ -45,17 +45,16 @@
 #include "nsGlobalWindow.h"
 #include "nsIDocument.h"
 #include "nsIFocusController.h"
 
 #include "nsContentUtils.h"
 
 #include "nsIFrame.h"
 #include "nsIWidget.h"
-#include "nsIView.h"
 #include "nsGUIEvent.h"
 
 #ifdef MOZ_ENABLE_GTK2
 #include <gdk/gdkx.h>
 #endif
 
 NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils)
@@ -170,17 +169,17 @@ nsDOMWindowUtils::SendMouseEvent(const n
                                  PRInt32 aModifiers)
 {
   PRBool hasCap = PR_FALSE;
   if (NS_FAILED(nsContentUtils::GetSecurityManager()->IsCapabilityEnabled("UniversalXPConnect", &hasCap))
       || !hasCap)
     return NS_ERROR_DOM_SECURITY_ERR;
 
   // get the widget to send the event to
-  nsIWidget* widget = GetWidget();
+  nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return NS_ERROR_FAILURE;
 
   PRInt32 msg;
   if (aType.EqualsLiteral("mousedown"))
     msg = NS_MOUSE_BUTTON_DOWN;
   else if (aType.EqualsLiteral("mouseup"))
     msg = NS_MOUSE_BUTTON_UP;