Bug 269568 Prevent crash by starting drag session before firing drag enter event patch also seems to fix a couple of my other drag-and-drop issues r+sr=bryner

git-svn-id: svn://10.0.0.236/trunk@179443 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neil%parkwaycc.co.uk
2005-08-31 22:56:37 +00:00
parent 25fb129e36
commit 40ab77790d
2 changed files with 17 additions and 19 deletions

View File

@@ -82,6 +82,7 @@
#include "nsIDragService.h"
#include "nsIDragSessionGTK.h"
#include "nsAutoPtr.h"
#include "nsGtkIMEHelper.h"
#include "nsKeyboardUtils.h"
@@ -3513,15 +3514,8 @@ nsWindow::OnDragEnter(nscoord aX, nscoord aY)
#ifdef DEBUG_DND_EVENTS
g_print("nsWindow::OnDragEnter\n");
#endif /* DEBUG_DND_EVENTS */
nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
event.refPoint.x = aX;
event.refPoint.y = aY;
AddRef();
DispatchMouseEvent(event);
nsRefPtr<nsWindow> kungFuDeathGrip(this);
nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
@@ -3530,7 +3524,12 @@ nsWindow::OnDragEnter(nscoord aX, nscoord aY)
dragService->StartDragSession();
}
Release();
nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
event.refPoint.x = aX;
event.refPoint.y = aY;
DispatchMouseEvent(event);
}
void

View File

@@ -93,6 +93,7 @@ static const char sAccessibilityKey [] = "config.use_system_prefs.accessibility"
#include "nsIImage.h"
#include "nsIGdkPixbufImage.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsAutoPtr.h"
/* For PrepareNativeWidget */
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
@@ -2201,15 +2202,7 @@ nsWindow::OnDragEnter(nscoord aX, nscoord aY)
LOG(("nsWindow::OnDragEnter(%p)\n", this));
nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
event.refPoint.x = aX;
event.refPoint.y = aY;
AddRef();
nsEventStatus status;
DispatchEvent(&event, status);
nsRefPtr<nsWindow> kungFuDeathGrip(this);
nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
@@ -2218,7 +2211,13 @@ nsWindow::OnDragEnter(nscoord aX, nscoord aY)
dragService->StartDragSession();
}
Release();
nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
event.refPoint.x = aX;
event.refPoint.y = aY;
nsEventStatus status;
DispatchEvent(&event, status);
}
nsresult