Minor fixes to plug memory hole, will add WXLO import ASAP.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1999-11-08 20:55:14 +00:00
parent 2f5292c3df
commit 3b0c8308f1

View File

@@ -1121,7 +1121,11 @@ wxLayoutWindow::Copy(bool invalidate)
wxLayoutDataObject *wldo = new wxLayoutDataObject; wxLayoutDataObject *wldo = new wxLayoutDataObject;
wxLayoutList *llist = m_llist->GetSelection(wldo, invalidate); wxLayoutList *llist = m_llist->GetSelection(wldo, invalidate);
if(! llist) if(! llist)
{
delete wldo;
delete data;
return FALSE; return FALSE;
}
// Export selection as text: // Export selection as text:
wxString text; wxString text;
wxLayoutExportObject *exp; wxLayoutExportObject *exp;
@@ -1134,6 +1138,7 @@ wxLayoutWindow::Copy(bool invalidate)
} }
delete llist; delete llist;
bool rc;
// The exporter always appends a newline, so we chop it off if it // The exporter always appends a newline, so we chop it off if it
// is there: // is there:
{ {
@@ -1144,19 +1149,20 @@ wxLayoutWindow::Copy(bool invalidate)
text = text.Mid(0,len-1); text = text.Mid(0,len-1);
} }
if (!wxTheClipboard->Open()) if (wxTheClipboard->Open())
return FALSE; {
#if wxUSE_PRIVATE_CLIPBOARD_FORMAT #if wxUSE_PRIVATE_CLIPBOARD_FORMAT
data->Add(wldo, TRUE /* preferred */); data->Add(wldo, TRUE /* preferred */);
data->Add(new wxTextDataObject(text)); data->Add(new wxTextDataObject(text));
#else
wxTextDataObject *data = new wxTextDataObject( text );
#endif #endif
rc = wxTheClipboard->SetData( data );
bool rc = wxTheClipboard->SetData( data );
wxTheClipboard->Close(); wxTheClipboard->Close();
}
else
rc = FALSE;
delete wldo;
delete data;
return rc; return rc;
} }