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