Bug 604860: Stop doing silly leaky stuff with nsDataObjs. r=jimm a=joe

This commit is contained in:
Kyle Huey 2010-10-19 17:21:10 -04:00
parent 9b468f97d9
commit 6f188e4a26
4 changed files with 7 additions and 80 deletions

View File

@ -756,15 +756,11 @@ STDMETHODIMP nsDataObj::EndOperation(HRESULT hResult,
DWORD dwEffects)
{
mIsInOperation = FALSE;
Release();
return S_OK;
}
STDMETHODIMP nsDataObj::GetAsyncMode(BOOL *pfIsOpAsync)
{
if (!pfIsOpAsync)
return E_FAIL;
*pfIsOpAsync = mIsAsyncMode;
return S_OK;
@ -772,9 +768,6 @@ STDMETHODIMP nsDataObj::GetAsyncMode(BOOL *pfIsOpAsync)
STDMETHODIMP nsDataObj::InOperation(BOOL *pfInAsyncOp)
{
if (!pfInAsyncOp)
return E_FAIL;
*pfInAsyncOp = mIsInOperation;
return S_OK;

View File

@ -257,48 +257,6 @@ void nsDataObjCollection::AddDataObject(IDataObject * aDataObj)
mDataObjects.AppendElement(dataObj);
}
// IAsyncOperation methods
STDMETHODIMP nsDataObjCollection::EndOperation(HRESULT hResult,
IBindCtx *pbcReserved,
DWORD dwEffects)
{
mIsInOperation = FALSE;
Release();
return S_OK;
}
STDMETHODIMP nsDataObjCollection::GetAsyncMode(BOOL *pfIsOpAsync)
{
if (!pfIsOpAsync)
return E_FAIL;
*pfIsOpAsync = mIsAsyncMode;
return S_OK;
}
STDMETHODIMP nsDataObjCollection::InOperation(BOOL *pfInAsyncOp)
{
if (!pfInAsyncOp)
return E_FAIL;
*pfInAsyncOp = mIsInOperation;
return S_OK;
}
STDMETHODIMP nsDataObjCollection::SetAsyncMode(BOOL fDoOpAsync)
{
mIsAsyncMode = fDoOpAsync;
return S_OK;
}
STDMETHODIMP nsDataObjCollection::StartOperation(IBindCtx *pbcReserved)
{
mIsInOperation = TRUE;
return S_OK;
}
// Methods for getting data
HRESULT nsDataObjCollection::GetFile(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
{

View File

@ -154,14 +154,6 @@ class nsDataObjCollection : public nsIDataObjCollection, public nsDataObj
// Return the adapter
//CfDragDrop& GetDragDrop() const;
// IAsyncOperation methods
STDMETHOD(EndOperation)(HRESULT hResult, IBindCtx *pbcReserved,
DWORD dwEffects);
STDMETHOD(GetAsyncMode)(BOOL *pfIsOpAsync);
STDMETHOD(InOperation)(BOOL *pfInAsyncOp);
STDMETHOD(SetAsyncMode)(BOOL fDoOpAsync);
STDMETHOD(StartOperation)(IBindCtx *pbcReserved);
protected:
BOOL FormatsMatch(const FORMATETC& source, const FORMATETC& target) const;

View File

@ -303,34 +303,18 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj,
// Start dragging
StartDragSession();
// check shell32.dll version and do async drag if it is >= 5.0
PRUint64 lShellVersion = GetShellVersion();
IAsyncOperation *pAsyncOp = NULL;
PRBool isAsyncAvailable = LL_UCMP(lShellVersion, >=, LL_INIT(5, 0));
if (isAsyncAvailable)
{
// do async drag
if (SUCCEEDED(aDataObj->QueryInterface(IID_IAsyncOperation,
(void**)&pAsyncOp)))
pAsyncOp->SetAsyncMode(VARIANT_TRUE);
nsRefPtr<IAsyncOperation> pAsyncOp;
// Offer to do an async drag
if (SUCCEEDED(aDataObj->QueryInterface(IID_IAsyncOperation,
getter_AddRefs(pAsyncOp)))) {
pAsyncOp->SetAsyncMode(VARIANT_TRUE);
} else {
NS_NOTREACHED("When did our data object stop being async");
}
// Call the native D&D method
HRESULT res = ::DoDragDrop(aDataObj, mNativeDragSrc, effects, &winDropRes);
if (isAsyncAvailable)
{
// if dragging async
// check for async operation
BOOL isAsync = FALSE;
if (pAsyncOp)
{
pAsyncOp->InOperation(&isAsync);
if (!isAsync)
aDataObj->Release();
}
}
// In cases where the drop operation completed outside the application, update
// the source node's nsIDOMNSDataTransfer dropEffect value so it is up to date.
if (!mSentLocalDropEvent) {