mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 11:15:34 +00:00
Now deletes memory returned from the transferable
This commit is contained in:
parent
ebb98de6ad
commit
a236c8a98b
@ -631,12 +631,16 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard()
|
||||
PRUint32 dataLen;
|
||||
|
||||
// Get the data as a bunch-o-bytes from the clipboard
|
||||
// this call hands back new memory with the contents copied into it
|
||||
mTransferable->GetTransferData(df, &data, &dataLen);
|
||||
|
||||
// now place it on the Clipboard
|
||||
if (nsnull != data) {
|
||||
PlaceDataOnClipboard(format, (char *)data, dataLen);
|
||||
}
|
||||
|
||||
// Now, delete the memory that was created by the transferable
|
||||
delete [] data;
|
||||
}
|
||||
}
|
||||
delete dfList;
|
||||
|
@ -329,7 +329,7 @@ HRESULT nsDataObj::GetText(nsString * aDF, FORMATETC& aFE, STGMEDIUM& aSTG)
|
||||
char * data;
|
||||
PRUint32 len;
|
||||
|
||||
// NOTE: Transferable keeps ownership of the memory
|
||||
// NOTE: Transferable creates new memory, that needs to be deleted
|
||||
mTransferable->GetTransferData(aDF, (void **)&data, &len);
|
||||
if (0 == len) {
|
||||
return ResultFromScode(E_FAIL);
|
||||
@ -387,6 +387,9 @@ HRESULT nsDataObj::GetText(nsString * aDF, FORMATETC& aFE, STGMEDIUM& aSTG)
|
||||
|
||||
aSTG.hGlobal = hGlobalMemory;
|
||||
|
||||
// Now, delete the memory that was created by the transferable
|
||||
delete [] data;
|
||||
|
||||
return ResultFromScode(S_OK);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user