Copy dropped data to wxDataViewEvent
Existing code relies on GetDataBuffer() returning a valid pointer, so we need to ensure that this is the case, even if this means copying the data into an internal buffer.
This commit is contained in:
parent
7797ffc730
commit
33018ea7a9
2 changed files with 12 additions and 1 deletions
|
|
@ -972,6 +972,7 @@ protected:
|
|||
#if wxUSE_DRAG_AND_DROP
|
||||
wxDataObject *m_dataObject;
|
||||
|
||||
wxMemoryBuffer m_dataBuf;
|
||||
wxDataFormat m_dataFormat;
|
||||
void* m_dataBuffer;
|
||||
size_t m_dataSize;
|
||||
|
|
|
|||
|
|
@ -1812,7 +1812,17 @@ void wxDataViewEvent::InitData(wxDataObjectComposite* obj, wxDataFormat format)
|
|||
SetDataFormat(format);
|
||||
|
||||
SetDataObject(obj->GetObject(format));
|
||||
SetDataSize(obj->GetDataSize(format));
|
||||
|
||||
const size_t size = obj->GetDataSize(format);
|
||||
SetDataSize(size);
|
||||
|
||||
if ( size )
|
||||
{
|
||||
obj->GetDataHere(format, m_dataBuf.GetWriteBuf(size));
|
||||
m_dataBuf.UngetWriteBuf(size);
|
||||
|
||||
SetDataBuffer(m_dataBuf.GetData());
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue