different solution to debug messages

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-05-21 12:43:24 +00:00
parent 42f14e5e2b
commit a1485bc734
2 changed files with 20 additions and 4 deletions

View File

@@ -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 );
}

View File

@@ -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 )
{