Bug 728663: Stop holding a completely unnecessary and leaky reference to the drag source on the drag service. r=jimm

This commit is contained in:
Kyle Huey 2012-05-11 11:32:08 -07:00
Родитель 1e3f6a505d
Коммит f7f7818986
2 изменённых файлов: 5 добавлений и 12 удалений

Просмотреть файл

@ -81,7 +81,7 @@
//
//-------------------------------------------------------------------------
nsDragService::nsDragService()
: mNativeDragSrc(nsnull), mNativeDragTarget(nsnull), mDataObject(nsnull), mSentLocalDropEvent(false)
: mNativeDragTarget(nsnull), mDataObject(nsnull), mSentLocalDropEvent(false)
{
}
@ -92,7 +92,6 @@ nsDragService::nsDragService()
//-------------------------------------------------------------------------
nsDragService::~nsDragService()
{
NS_IF_RELEASE(mNativeDragSrc);
NS_IF_RELEASE(mNativeDragTarget);
NS_IF_RELEASE(mDataObject);
}
@ -274,13 +273,8 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj,
{
// To do the drag we need to create an object that
// implements the IDataObject interface (for OLE)
nsNativeDragSource* nativeDragSource = new nsNativeDragSource(mDataTransfer);
if (!nativeDragSource)
return NS_ERROR_OUT_OF_MEMORY;
NS_IF_RELEASE(mNativeDragSrc);
mNativeDragSrc = (IDropSource *)nativeDragSource;
mNativeDragSrc->AddRef();
nsRefPtr<nsNativeDragSource> nativeDragSrc =
new nsNativeDragSource(mDataTransfer);
// Now figure out what the native drag effect should be
DWORD winDropRes;
@ -314,7 +308,7 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj,
}
// Call the native D&D method
HRESULT res = ::DoDragDrop(aDataObj, mNativeDragSrc, effects, &winDropRes);
HRESULT res = ::DoDragDrop(aDataObj, nativeDragSrc, effects, &winDropRes);
// In cases where the drop operation completed outside the application, update
// the source node's nsIDOMDataTransfer dropEffect value so it is up to date.
@ -338,7 +332,7 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj,
}
}
mUserCancelled = nativeDragSource->UserCancelled();
mUserCancelled = nativeDragSrc->UserCancelled();
// We're done dragging, get the cursor position and end the drag
// Use GetMessagePos to get the position of the mouse at the last message

Просмотреть файл

@ -90,7 +90,6 @@ protected:
nsIScriptableRegion *aRegion,
SHDRAGIMAGE *psdi);
IDropSource * mNativeDragSrc;
nsNativeDragTarget * mNativeDragTarget;
IDataObject * mDataObject;
bool mSentLocalDropEvent;