Using strcpy() in GetDataHere() added an extra NUL at the end which
didn't fit into the buffer of the size returned by GetDataSize(). This
could have been also fixed by returning an extra byte from the latter
function, but as the string doesn't need to be NUL-terminated,
apparently, just use memcpy() with the correct number of bytes instead.
Also, because the string is not necessarily NUL-terminated, use the
provided length in wxHTMLDataObject::SetData() instead of relying on the
buffer being NUL-terminated and reading uninitialized memory beyond its
size.
Add a unit test confirming that there are no more ASAN errors when using
this class.
Closes#23660.
Co-Authored-By: mcorino <martin@corino.nl>
Instead of just adding 400 and leaving unused and uninitialized data in
the clipboard data, compute exactly the size of the data we need.
Also replace multiple strlen() calls that are not really needed because
we already know the various lengths.
Still NUL-terminate clipboard data because everybody else does it, even
if it's not totally clear if it is required.
Use StartFragment and EndFragment headers values in order to extract the
HTML fragment from the entire CF_HTML string, instead of searching for
"<!--StartFragment-->" and "<!--EndFragment-->" comments which could be
wrong (e.g. if a StartFragment comment actually appeared inside the HTML
fragment) and less efficient too.
Also add a simple pseudo-test, disabled by default, allowing to view the
clipboard contents if HTML is available on it.
Notable use the correct value for StartFragment: header which must
contain the start of the HTML fragment data and not the start of
"<--StartFragment-->" comment.
Also make this code simpler and more efficient by remembering the
offsets as we're creating the string instead of using strstr() to find
them later.
No other program does it and having these extra new lines means that our
own GetData() returns extra new lines compared to the value passed to
SetData().
When wxClipboard is destroyed as part of the program shutdown,
gdk_selection_owner_get() doesn't return our clipboard widget as owner
any more, so we don't reset the owner when Clear() is called and hence
never free the data.
Do it explicitly if we don't have clipboard ownership in Clear() any
longer to avoid memory leaks -- even though they are mostly harmless (as
they happen only once, on exit), they still show up in LSAN and similar
tools reports.
Revert the change introduced in b473163da2
and restore the setting of the background of delta-RLE bitmaps to the
first entry in the colour table. This retains earlier wxWidgets
behaviour and matches Windows `LoadImage()` with `LR_CREATEDIBSECTION`.
Closes#23638.
Closes#23657.
This function should be used to get the parent for the custom controls
instead of relying on them being reparented under it by the code added
in the last commit.
Change the type of m_contents to be wxWindow and not wxPanel as it
doesn't really matter, but wxPanel is not fully declared in this header
while wxWindow is.
Existing code uses the dialog itself for the custom controls created in
this function, so make this work by reparenting them under m_contents.
This fixes an assert about the wrong parent window when showing a custom
about dialog in the dialogs sample.
Closes#23653.
This avoids crash if wxVSCROLL or wxHSCROLL is used with wxGLCanvas
which calls wxWindow::Create() after calling DontCreatePeer() because
the Create() tries to use the not (yet) existent peer in
MacCreateScrollBars().
Avoid this problem by moving the call to MacCreateScrollBars() to
MacPostControlCreate(), which doesn't change anything for the windows
that do not call DontCreatePeer(), but ensures that the peer already
exists by the time MacPostControlCreate() is called for those that do.
Closes#23536.
This was broken in ce1ee46 (Use wxRadioButton in MSW wxRadioBox
implementation, 2022-12-24), fix it by using a wxRadioButton subclass
processing just the cursor arrow keys but not TAB.
Closes#23647.
Now that we have wxRadioBoxButton we can simply store its index in it
and use it directly when it's clicked instead of finding the button in
m_radioButtons vector.
No real changes yet, just prepare for the upcoming commits by adding a
custom subclass that will be used by wxRadioBox instead of using
wxRadioButton directly.
In the note about building wxWidgets with MinGW makefile and using
parallel build, explain that "-jN" option cannot be used when building
"setup_h" target.
Closes#23642.
We need to check for the column row to avoid generating an event with an
invalid index, which may result in a crash in the application code.
Closes#23636.
libwebkit2gtk-4.1 has the same API as libwebkit2gtk-4.0, except that the
former links with libsoup-3.0 and the latter links with libsoup-2.4.
Fixes#23630.
Checking LOCATION{_CONFIG} property on interfaces is only supported since CMake 3.19.
Also check the LOCATION and IMPORTED_LIBNAME properties for possible library locations.
Fixes#23632
The _NL_WALTMON_xxx constants used since 5b424ea181 (Add wxUILocale
methods for getting month and day names, 2023-05-24) are only available
in glibc 2.27 or later.
See #23191.
Since 1c64bd506c (Use grep instead of fgrep and egrep, 2023-05-10) EGREP
wasn't defined in CMake build any longer, so finding the correct config
script always failed.
Fix this by using "grep -E" directly instead of "$EGREP".
Avoid implicit copy constructor warnings by using
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY/wxDECLARE_NO_ASSIGN_DEF_COPY
instead of wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN.
Closes#23625.
Closes#23626.
CMake's has built-in support for checking xkbcommon using FindX11 since
3.18.
But because older CMake versions are supported, add our own module that
checks if the header and library is available.
See #23410.
Closes#23613.
XPM files demonstrating the use of wxBitmapBundle in the XRC files
were not copied when building the XRC sample with CMake.
This should have been part of eaa769a (Use wxBitmapBundle in
wxBitmapComboBox XRC handler, 2022-02-09).
Closes#23612.