From 3c7037000b0570f921c73481f222fde6bc194d35 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 1 Jul 2012 13:20:33 +0000 Subject: [PATCH] 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 --- src/osx/carbon/dataobj.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index f270fb06a0..754b6386c8 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -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 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 dest(CFURLCreateFromFileSystemRepresentation(NULL,(const UInt8*)result,strlen(result),true)); + PasteboardSetPasteLocation(pasteboard, dest); + pastelocationset = true; + } } else if ( flavorFormat.GetType() != wxDF_PRIVATE ) { -- 2.45.2