git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56403
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->selection))).c_str(),
GPOINTER_TO_UINT( signal_data )
);
wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->selection))).c_str(),
GPOINTER_TO_UINT( signal_data )
);
- if (!data->IsSupportedFormat( format )) return;
+ if ( !data->IsSupportedFormat( format ) )
+ return;
int size = data->GetDataSize( format );
int size = data->GetDataSize( format );
- if (size == 0) return;
-
- wxCharBuffer buf(size);
+ wxCharBuffer buf(size - 1); // it adds 1 internally (for NUL)
// text data must be returned in UTF8 if format is wxDF_UNICODETEXT
// text data must be returned in UTF8 if format is wxDF_UNICODETEXT
- data->GetDataHere( format, buf.data() );
+ if ( !data->GetDataHere(format, buf.data()) )
+ return;
// use UTF8_STRING format if requested in Unicode build but just plain
// STRING one in ANSI or if explicitly asked in Unicode
// use UTF8_STRING format if requested in Unicode build but just plain
// STRING one in ANSI or if explicitly asked in Unicode
{
gtk_selection_data_set(
selection_data,
{
gtk_selection_data_set(
selection_data,