changes so that transferable no longer takes ownership of dataflavor string, but correctly copies it. fix some memory leaks as well.

git-svn-id: svn://10.0.0.236/trunk@34060 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pinkerton%netscape.com
1999-06-07 20:43:23 +00:00
parent 00efc527ff
commit 2c58808b6f
5 changed files with 44 additions and 49 deletions

View File

@@ -824,14 +824,13 @@ nsFrame::HandleEvent(nsIPresContext& aPresContext,
rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull,
nsITransferable::GetIID(), getter_AddRefs(trans2));
if ( trans && trans2 ) {
nsString* flavor = new nsString("text/plain");
trans->AddDataFlavor(flavor); // transferable consumes the flavor
nsString textPlainFlavor ( "text/plain" );
trans->AddDataFlavor(&textPlainFlavor);
nsString dragText = "Drag Text";
PRUint32 len = 9;
trans->SetTransferData(flavor, dragText.ToNewCString(), len); // transferable consumes the data
nsString* flavor2 = new nsString("text/plain");
trans2->AddDataFlavor(flavor2); // transferable consumes the flavor
trans2->AddDataFlavor(&textPlainFlavor);
nsString dragText2 = "More Drag Text";
len = 14;
trans2->SetTransferData(flavor2, dragText2.ToNewCString(), len); // transferable consumes the data