diff --git a/src/mac/carbon/dataobj.cpp b/src/mac/carbon/dataobj.cpp index ba88d93333..9e26c3c802 100644 --- a/src/mac/carbon/dataobj.cpp +++ b/src/mac/carbon/dataobj.cpp @@ -277,8 +277,7 @@ void wxDataObject::AddToPasteboard( void * pb, int itemID ) CFRelease(url); PasteboardPutItemFlavor( pasteboard, (PasteboardItemID) counter, (CFStringRef) thisFormat.GetFormatId() , data, kPasteboardFlavorNoFlags); - // don't release do CFRelease( data ), it's not documented but the samples don't release the data for non promised entries - // also when running with the _debug version of carbon drag and drop is showing errors otherwise + CFRelease( data ); counter++; fname = strtok (NULL,"\n"); } @@ -293,8 +292,7 @@ void wxDataObject::AddToPasteboard( void * pb, int itemID ) else PasteboardPutItemFlavor( pasteboard, (PasteboardItemID) itemID, (CFStringRef) thisFormat.GetFormatId() , data, kPasteboardFlavorNoFlags); - // don't release do CFRelease( data ), it's not documented but the samples don't release the data for non promised entries - // also when running with the _debug version of carbon drag and drop is showing errors otherwise + CFRelease( data ); } free( buf ); } diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index bee0d543ee..12b7fc1cae 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -217,6 +217,16 @@ wxDropSource::~wxDropSource() { } +OSStatus wxMacPromiseKeeper( PasteboardRef inPasteboard, PasteboardItemID inItem, CFStringRef inFlavorType, + void *inContext ) +{ + OSStatus err = noErr; + + // we might add promises here later, inContext is the wxDropSource* + + return err; +} + wxDragResult wxDropSource::DoDragDrop(int flags) { wxASSERT_MSG( m_data, wxT("Drop source: no data") ); @@ -235,6 +245,14 @@ wxDragResult wxDropSource::DoDragDrop(int flags) if ( err != noErr ) return wxDragNone; + // we add a dummy promise keeper because of strange messages when linking against carbon debug + err = PasteboardSetPromiseKeeper( pasteboard, wxMacPromiseKeeper, this ); + if ( err != noErr ) + { + CFRelease( pasteboard ); + return wxDragNone; + } + err = PasteboardClear( pasteboard ); if ( err != noErr ) {