]> git.saurik.com Git - wxWidgets.git/commitdiff
make sure the pasteboard paste location is only set once
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 1 Jul 2012 13:20:33 +0000 (13:20 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 1 Jul 2012 13:20:33 +0000 (13:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/dataobj.cpp

index f270fb06a09ace2af88749d4981f6f61460fd997..754b6386c82a5cbe1577c04033dfab632ca7337a 100644 (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 )
                         {