make sure the pasteboard paste location is only set once

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2012-07-01 13:20:33 +00:00
parent fa88bebec1
commit 3c7037000b

View File

@@ -401,6 +401,7 @@ bool wxDataObject::GetFromPasteboard( void * pb )
ItemCount itemCount = 0; ItemCount itemCount = 0;
wxString filenamesPassed; wxString filenamesPassed;
bool transferred = false; bool transferred = false;
bool pastelocationset = false;
// we synchronize here once again, so we don't mind which flags get returned // we synchronize here once again, so we don't mind which flags get returned
PasteboardSynchronize( pasteboard ); PasteboardSynchronize( pasteboard );
@@ -443,6 +444,8 @@ bool wxDataObject::GetFromPasteboard( void * pb )
if ( dataFormat == flavorFormat ) if ( dataFormat == flavorFormat )
{ {
if ( UTTypeConformsTo( (CFStringRef)flavorType, kPasteboardTypeFileURLPromise) ) if ( UTTypeConformsTo( (CFStringRef)flavorType, kPasteboardTypeFileURLPromise) )
{
if ( !pastelocationset )
{ {
wxString tempdir = wxFileName::GetTempDir() + wxFILE_SEP_PATH + "wxtemp.XXXXXX"; wxString tempdir = wxFileName::GetTempDir() + wxFILE_SEP_PATH + "wxtemp.XXXXXX";
char* result = mkdtemp((char*)tempdir.fn_str().data()); char* result = mkdtemp((char*)tempdir.fn_str().data());
@@ -452,6 +455,8 @@ bool wxDataObject::GetFromPasteboard( void * pb )
wxCFRef<CFURLRef> dest(CFURLCreateFromFileSystemRepresentation(NULL,(const UInt8*)result,strlen(result),true)); wxCFRef<CFURLRef> dest(CFURLCreateFromFileSystemRepresentation(NULL,(const UInt8*)result,strlen(result),true));
PasteboardSetPasteLocation(pasteboard, dest); PasteboardSetPasteLocation(pasteboard, dest);
pastelocationset = true;
}
} }
else if ( flavorFormat.GetType() != wxDF_PRIVATE ) else if ( flavorFormat.GetType() != wxDF_PRIVATE )
{ {