2892794d70
Fix a long-standing bug in wxMSW wxTextDataObject which returned the size including the trailing NUL from its GetDataSize() and used the same convention in GetData(), but didn't account for this NUL being included into the buffer passed to SetData(). This was partially compensated by also passing the wrong (too small) buffer size when calling SetData() from wxIDataObject, but still resulted in problems when using SetData() with the length returned from GetDataSize(), as done in wxDataViewCtrl code. Fix this by now always considering NUL part of the buffer (as this is the platform convention, i.e. all CF_TEXT data on the system clipboard must include the trailing NUL) and taking it into account when determining the buffer size in wxIDataObject. This change is not fully backwards-compatible as it breaks any code calling SetData() directly, as e.g. wxURLDataObject in wxMSW itself did, so document it as such, but it's still worth making it as there doesn't seem to be any other way of fixing the problem described in the linked issue and direct calls to SetData() should be rare as simpler SetText() should be used instead. Also add a unit test for wxTextDataObject and extend the existing test of wxURLDataObject. This commit is a modified version of the master one as it still accepts non-NUL terminated strings too, for compatibility, so it shouldn't break any existing code. See #22928, #23018. (cherry picked from commit d737d98d278a43ef4b16a756f3115bbf65962358) |
||
---|---|---|
.. | ||
dynamiclib.cpp | ||
environ.cpp | ||
garbage.cpp | ||
guifuncs.cpp | ||
metatest.cpp | ||
misctests.cpp | ||
module.cpp | ||
pathlist.cpp | ||
safearrayconverttest.cpp | ||
selstoretest.cpp | ||
settings.cpp | ||
typeinfotest.cpp |