X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e135f09367836c25fc6268881d3260244bdd98d5..ee658398812ab334b39a2632cd99e2ffe6d4bc79:/src/mac/clipbrd.cpp diff --git a/src/mac/clipbrd.cpp b/src/mac/clipbrd.cpp index d7a5b8bc52..6cbc655fc6 100644 --- a/src/mac/clipbrd.cpp +++ b/src/mac/clipbrd.cpp @@ -136,18 +136,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) return NULL ; } - if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC ) + if ( dataFormat.GetType() == wxDF_TEXT ) { - wxString st = wxMacMakeStringFromCString( (char*) data ) ; -#if wxUSE_UNICODE - wxCharBuffer buf = st.ToAscii() ; -#else - const char* buf = st ; -#endif - char* newdata = new char[strlen(buf)+1] ; - memcpy( newdata , buf , strlen(buf)+1 ) ; - delete[] ((char*) data ) ; - data = newdata ; + wxMacConvertNewlines10To13( (char*) data ) ; } return data; @@ -252,8 +243,7 @@ bool wxClipboard::AddData( wxDataObject *data ) case wxDF_OEMTEXT: { wxTextDataObject* textDataObject = (wxTextDataObject*) data; - wxString str(textDataObject->GetText()); - wxCharBuffer buf = wxMacStringToCString( str ) ; + wxCharBuffer buf = textDataObject->GetText().mb_str() ; err = UMAPutScrap( strlen(buf) , kScrapFlavorTypeText , (void*) buf.data() ) ; } break ; @@ -308,6 +298,15 @@ bool wxClipboard::AddData( wxDataObject *data ) void wxClipboard::Close() { m_open = false ; + + // Get rid of cached object. If this is not done copying from another application will + // only work once + if (m_data) + { + delete m_data; + m_data = (wxDataObject*) NULL; + } + } bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )