Bug 585961. r=roc a=blocking2.0:final

This commit is contained in:
Mats Palmgren 2010-08-14 01:58:19 +02:00
parent 7e8331713b
commit 338408d9e4

View File

@ -399,16 +399,23 @@ nsNativeDragTarget::Drop(LPDATAOBJECT pData,
// This cast is ok because in the constructor we created a
// the actual implementation we wanted, so we know this is
// a nsDragService (but it should still be a private interface)
nsDragService * winDragService =
static_cast<nsDragService *>(mDragService);
nsDragService* winDragService = static_cast<nsDragService*>(mDragService);
winDragService->SetIDataObject(pData);
// Note: Calling ProcessDrag can destroy us; don't touch members after that.
// NOTE: ProcessDrag spins the event loop which may destroy arbitrary objects.
// We use strong refs to prevent it from destroying these:
nsRefPtr<nsNativeDragTarget> kungFuDeathGrip = this;
nsCOMPtr<nsIDragService> serv = mDragService;
// Now process the native drag state and then dispatch the event
ProcessDrag(pData, NS_DRAGDROP_DROP, grfKeyState, aPT, pdwEffect);
nsCOMPtr<nsIDragSession> currentDragSession;
serv->GetCurrentSession(getter_AddRefs(currentDragSession));
if (!currentDragSession) {
return S_OK; // DragCancel() was called.
}
// Let the win drag service know whether this session experienced
// a drop event within the application. Drop will not oocur if the
// drop landed outside the app. (used in tab tear off, bug 455884)