Commit Graph
80438 Commits
Author SHA1 Message Date
Vadim Zeitlin fe360d4d01 Handle invalid wxColour better in unit test assertions
Show invalid colour as "invalid" instead of "" and don't trigger a wx
assertion when comparing with it.
2026-08-06 22:15:55 +02:00
Vadim Zeitlin 8d8967a29a Merge branch 'ipc-tcp'
Fix multiple issues in IPC using TCP sockets.

This is a substantial rewrite of the old code which brings improved
error detection, MT-safety and many other fixes.

There is also a much better test suite exercising this code now.

See #24858.
2026-08-06 22:01:13 +02:00
Vadim Zeitlin 43824ccb33 Don't use separate timeout for sanitizer builds in IPC tests
Keep the code simpler, we shouldn't need to wait for 2 minutes anyhow.
2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin 6476f7e365 Disable Nagle algorithm on IPC connection sockets
wxIPC messages are small, and each one is sent as more than one short
write() call (the code word, then the payload). With Nagle's algorithm
enabled, this write-write-read pattern makes every request/reply round
trip stall on a delayed-ACK period: a Request() over loopback measured
roughly 85ms with the default socket options and well under 1ms with
TCP_NODELAY set.

Beyond the raw latency, the slow round trips are long enough to starve
other threads using the same connection. A Request() holds the reply
serialization lock for its whole round trip, so a main thread issuing
requests in a loop kept the lock busy about 95% of the time, and a
worker thread could then wait for seconds to acquire it, since mutex
wakeups are not fair. On slower machines this made the multithreaded
IPC test intermittently exceed its 30 second deadlock watchdog.

Set TCP_NODELAY on both ends of the connection: small-message
request/reply protocols are the textbook case for disabling Nagle. The
option is harmlessly refused on the Unix domain sockets used when the
server name is a path, as there is no Nagle to disable there.

This also cuts the IPC test suite runtime to roughly a third.
2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin e9c3ce696e Replace IPC buffer ring with per-thread reply buffers
Request() may be called concurrently from several threads, and the
fixed-size MAX_MSG_BUFFERS ring shared by all of them could free a
buffer while the thread it was returned to was still reading it: the
number of intervening allocations needed to wrap the ring is arbitrary,
so no ring size is actually safe.

Instead, tie each buffer's lifetime to the thread consuming it:

- The buffer filled by ReadSizeAndData() is now owned by the message
  object itself, so data passed to OnExecute()/OnPoke()/OnAdvise() is
  freed with the message and remains valid for the duration of the
  callback.

- Request() hands the reply buffer over to a thread-specific holder, so
  the returned pointer stays valid until the next Request() on the same
  thread, and requests made concurrently from different threads cannot
  invalidate each other's data.

This removes MAX_MSG_BUFFERS and its arbitrary magic number entirely,
along with the wxTCPEventHandler buffer ring and the handler pointer
that the message classes only kept to reach it.

The thread-specific holder uses the same workaround for the MinGW
thread_local bug as UntranslatedStringHolder in translation.cpp.
2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin 8afe078c7c Reduce IPC socket timeout to 5 seconds 2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin 5dd17e884f Fix use-after-free in IPC test fixture when server startup times out
IPCFixture set the gs_clientLoop global mid-constructor but only cleared
it in the destructor. If the constructor threw after that assignment --
which happens when REQUIRE(serverReady) fails because the re-exec'd
server did not come up in time -- the object never became alive, so the
destructor never ran to null the global, yet the m_clientLoop member was
still destroyed during stack unwinding. That left gs_clientLoop dangling
at a freed wxEventLoop (and leaked gs_client), and the next fixture's
opening DrainPendingIPCEvents() dereferenced the freed loop. The defect
is single-threaded, so ThreadSanitizer never flagged it; AddressSanitizer
reports it as a heap-use-after-free in DrainPendingIPCEvents().

Make construction all-or-nothing with a dismissable guard that resets the
globals (and balances wxSocketBase::Shutdown()) on any early exit, and
raise the server-readiness bound to 120s under sanitizers, where the
instrumented server is much slower to start, so the timeout no longer
fires spuriously.
2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin 490bcc529a Fix IPC compilation with g++ 4.8
Returning a unique_ptr needs an explicit conversion to the base class
pointer for gcc 4.8, in order to fix the last failing CI build. A bare
std::move() is not enough, as it triggers -Wredundant-move in the
C++20 builds with newer compilers.
2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin d0b35778ac Always join IPC test server advise workers
WaitForAdviseWorkers() skipped Wait() when a worker thread had already
finished, but a joinable thread must be joined even then to release
its resources. The skipped joins showed up as ThreadSanitizer "thread
leak" reports in the re-executed server processes when running the
IPC tests under TSan.
2026-08-06 21:59:35 +02:00
John Paul MattiaandVadim Zeitlin e6425e469e Avoid dynamic casts of IPC messages to their concrete types
The concrete type of a message read from the socket is uniquely
determined by its IPC code: ReadMessageFromSocket() is the only place
creating them and it does so via GetIPCMessageFromCode(), which maps
each code to its class. So the dynamic casts performed after checking
GetIPCCode() could never fail, and their error branches were dead code.

Replace them with wxIPCMessageCast<T>(), a static_cast that still
checks the code/type invariant with an assert in debug builds. The two
wxDynamicCasts of OnMakeConnection()/OnAcceptConnection() results
remain: those virtuals are user-overridable and may return a type not
derived from wxTCPConnection, so the check there is genuinely dynamic.

Also fix a leak in wxTCPClient::MakeConnection(): with the cast moved
into the if declaration, "connection" is necessarily null in the else
branch, so deleting it leaked the object returned by
OnMakeConnection(). Delete connectionBase instead, as the server-side
counterpart in OnSocketConnection() already does.
2026-08-06 21:59:35 +02:00
Vadim Zeitlin d40c6dbc9f Work around gcc 4.8 bug after changes of last commit
Change GetAddressFromName() to always return "addr" at the end.

This is done just to work around a bug in gcc 4.8 which complains about
the control reaching the end of non-void function otherwise.
2026-08-06 21:59:35 +02:00
Vadim Zeitlin ab5aa8045d Stop using manual memory management for wxSockAddress
Use unique_ptr<wxSockAddress> instead of allocating and deleting these
objects manually, this is simpler and less error-prone.

No real changes.
2026-08-06 21:59:35 +02:00
Vadim Zeitlin aecd1dc282 Style fixes to TCP IPC code
Use camelCase naming convention, reformat some code.
2026-08-06 21:59:35 +02:00
Vadim Zeitlin b9676176ff Avoid dynamic casts from the type to itself
This is confusing at best, perform real dynamic casts from base class
pointer to the derived one.
2026-08-06 21:59:35 +02:00
Vadim Zeitlin da2dcc4636 Modernize the code to use C++11 constexpr and ranged-for
Prefer constexpr to macros and ranged-for to index-based loops.
2026-08-06 21:59:35 +02:00
Vadim Zeitlin c0b25d7e86 Remove code for unsupported wxUSE_UNICODE==0 build
Leave only wxUSE_UNICODE branch and simplify UTF-8 conversions.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin 8b70724c6a Replace wxASSERT_MSG with subsequent test with wxCHECK_MSG
This is a more idiomatic way of checking for precondition.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin 33321e42f8 Remove unnecessary wxIPCMessageBase dtor definition
Virtual dtor is inherited from the base wxObject class anyhow.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin 40ad80f29e Use std::unordered_set instead of set when order doesn't matter
This container is preferred unless we really need the set to be ordered
which is not the case here.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin e636713658 Let compiler generate wxTCPServer ctor
There is no need to define it manually, leaving it as default is shorter
and more clear.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin f17abe5883 Use <define> instead of <cxxflags> in the test bakefile
Prefer using more specialized tag.

Regenerate the affected files.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin 25a1baa87c Don't show test information when running it as IPC server
This avoids logging it many times during the full test suite run which
was unnecessary and confusing.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin 9c1b1b1ea9 Extract showing information about the test in a separate function
No real changes, just factor out the function for showing information
about the test and its execution environment.
2026-08-06 21:59:34 +02:00
Vadim Zeitlin 975523516c Simplify checks for using the test in "IPC server" mode
Don't duplicate the complex preprocessor check multiple times, just
define wxHAS_TEST_IPC_SERVER once and check for it.

Also define the helper ShouldRunTestIPCServer() function which is more
clear than using wxGetEnv() explicitly.

No real changes.
2026-08-06 21:59:34 +02:00
John Paul MattiaandVadim Zeitlin 122ff6d7db Add a multithreaded test for IPC over sockets
Add a test exercising the IPC-over-sockets implementation from a single
thread and from multiple threads concurrently (Execute, Request, Poke,
Advise, combined Advise+Request, and concurrent main-thread and
worker-thread Request()s).

Each test starts its own server by re-executing the test program with
WX_IPC_TEST_SERVER set and shuts it down again in the fixture teardown, so
no server process outlives a test (or disturbs the unrelated GUI tests in
test_gui). The client runs in the main Catch2 process and queries the server
for state to verify it (Catch2 macros cannot run in the server process). The
wait loops are wall-clock bounded so they behave under a GUI event loop, and
a per-fixture watchdog aborts with a diagnostic if a test ever hangs rather
than letting CI time out.

The test runs in both the console "test" and the GUI "test_gui" programs. It
is excluded from one configuration: wxQt, whose event loop does not reliably
process a cross-thread CallAfter() (a wxQt bug fixed separately).
2026-08-06 21:59:34 +02:00
Steve CornettandVadim Zeitlin 4227d13440 Fix wxTextCtrl border switching from dark mode
Do not check dark mode in wxTextCtrl::CanApplyThemeBorder(). Instead,
improve the checking for themed border drawing in the WM_NCPAINT
handler.

This fixed the border appearance after switching from dark mode to the
light one.

Closes #26794.
2026-08-06 21:57:23 +02:00
PBandVadim Zeitlin 17e670dd60 Improve render sample using wxGCDC in wxMSW dark mode
When using wxGCDC (applies to both GDI+ and Direct2D backends)
created from wxPaintDC, the default text color is white even
in the dark mode.

Work around this by explicitly setting the text color to the window
foreground color.

Closes #26788.
2026-08-06 21:54:41 +02:00
Steve CornettandVadim Zeitlin f12b90aa93 Update wxStaticLine appearance when switching dark mode in wxMSW
Upon dark/light mode switch, update the wxStaticLine border style.

Closes #26786.
2026-08-06 21:53:03 +02:00
Blake-MaddenandVadim Zeitlin 2f14298b9c Fix memory leak with custom handlers in wxGTK wxWebView
Add missing call to g_object_unref() required to avoid leaking the
object returned by g_memory_input_stream_new_from_data().

Closes #26784.
2026-08-06 20:18:19 +02:00
mcorinoandVadim Zeitlin fa331f4e0f Mark wxApp::DarkMode as wxMSW-only in the documentation
Add missing @onlyfor{wxmsw}.

Closes #26792.
2026-08-06 20:15:46 +02:00
Vadim Zeitlin a37d42c80e Remove documentation of non-existent wxPanel::OnSysColourChanged()
This function seems to have never existed in wxPanel and was removed
from its base wxWindow class in 74ea434841 (Add a function to perform
internal processing of wxSysColourChangedEvent, 2026-07-28).

Closes #26791.
2026-08-06 20:10:33 +02:00
Steve CornettandVadim Zeitlin 9c60c62a12 Use DarkMode_DarkTheme with wxChoice if available
For wxChoice in dark mode, the theme DarkMode_DarkTheme looks a little
better, so use that if available.

See #26775.

Closes #26781.
2026-08-05 00:38:10 +02:00
Vadim Zeitlin e68720e2b5 Retry apt-get commands when using Ubuntu servers
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK UTF-8 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxQt (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxX11 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK 2 (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK gcc 7 static compatible 3.0 (push) Canceled after 0s
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxDFB (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Canceled after 0s
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Canceled after 0s
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Canceled after 0s
CMake builds / MSW/MSVC wxMSW (push) Canceled after 0s
CMake builds / MSW/Clang wxMSW (push) Canceled after 0s
CMake builds / macOS latest wxOSX Ninja (push) Canceled after 0s
CMake builds / macOS 14 wxOSX Xcode (push) Canceled after 0s
CMake builds / macOS 14 wxIOS (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 5.15 (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 6.10 (push) Canceled after 0s
Mac builds / wxMac ARM ASAN not compatible (push) Canceled after 0s
Mac builds / wxMac Universal C++14 (push) Canceled after 0s
Mac builds / wxiOS Simulator on Silicon Mac (push) Canceled after 0s
Mac builds / wxiOS (push) Canceled after 0s
Mac builds / wxMac Intel C++17 (push) Canceled after 0s
Mac Xcode builds / iOS Simulator static (push) Canceled after 0s
Mac Xcode builds / macOS dynamic Release (push) Canceled after 0s
Mac Xcode builds / iOS static Debug (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Release x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Debug Win32 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Release arm64 (push) Canceled after 0s
MSW builds / wxMSW vs2026 DLL Release x64 (push) Canceled after 0s
MSW cross-builds / wxMSW 64 bits not compatible (push) Canceled after 0s
MSW cross-builds / wxMSW/Univ (push) Canceled after 0s
MSW cross-builds / wxMSW 32 bits (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
Update Documentation / Update Online Documentation (push) Canceled after 0s
They still fail, even when using versions later than 18.04, but the
failure is usually temporary, so try them several times.
2026-08-04 20:17:37 +02:00
Steve CornettandVadim Zeitlin a5e16e55ae Use system colors for generic calendar header
Use system colors for generic calendar header instead of blue and gray.
A separator line is drawn below the header. This makes the control look
consistent with the Win32 and WinUI 3 controls. Custom header colors are
not overwritten by system color change event.

See #25552.

Closes #26777.
2026-08-04 18:49:41 +02:00
Steve CornettandVadim Zeitlin 5d4829d6d1 Make dark mode system colors more consistent with other platforms
Assign values for wxSYS_COLOUR_3DLIGHT and wxSYS_COLOUR_BTNHIGHLIGHT
consistent with Linux and macOS.

Also stop using wxSYS_COLOUR_BTNHIGHLIGHT for rendering disabled text in
wxGrid and wxGenericStaticText: it didn't look before and would be even
worse after this change. Instead, just draw the text in "disabled"
colour, without using drop shadow at all.

Closes #26753.
2026-08-04 18:46:45 +02:00
Vadim Zeitlin d13fad4371 Prefer calling wxMSW dark mode support "unofficial"
It's not "experimental" any longer, but we still want to make it clear
that this isn't supported as well as standard mode.

Closes #26752.
2026-08-04 18:40:42 +02:00
Paul Cornett 061b99fda1 Avoid crash on GTK if wxTextCtrl text is modified in wxEVT_TEXT handler
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK UTF-8 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxQt (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxX11 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK 2 (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK gcc 7 static compatible 3.0 (push) Canceled after 0s
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxDFB (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Canceled after 0s
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Canceled after 0s
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Canceled after 0s
CMake builds / MSW/MSVC wxMSW (push) Canceled after 0s
CMake builds / MSW/Clang wxMSW (push) Canceled after 0s
CMake builds / macOS latest wxOSX Ninja (push) Canceled after 0s
CMake builds / macOS 14 wxOSX Xcode (push) Canceled after 0s
CMake builds / macOS 14 wxIOS (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 5.15 (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 6.10 (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
The text iterators used in the "after" callbacks are no longer valid
if the text has been modified.
See #26742
2026-08-03 15:22:59 -07:00
Vadim Zeitlin f7f534cd13 Merge branch 'sdl3' of github.com:MaartenBent/wxWidgets
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK UTF-8 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxQt (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxX11 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK 2 (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK gcc 7 static compatible 3.0 (push) Canceled after 0s
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxDFB (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Canceled after 0s
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Canceled after 0s
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Canceled after 0s
CMake builds / MSW/MSVC wxMSW (push) Canceled after 0s
CMake builds / MSW/Clang wxMSW (push) Canceled after 0s
CMake builds / macOS latest wxOSX Ninja (push) Canceled after 0s
CMake builds / macOS 14 wxOSX Xcode (push) Canceled after 0s
CMake builds / macOS 14 wxIOS (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 5.15 (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 6.10 (push) Canceled after 0s
Mac builds / wxMac ARM ASAN not compatible (push) Canceled after 0s
Mac builds / wxMac Universal C++14 (push) Canceled after 0s
Mac builds / wxiOS Simulator on Silicon Mac (push) Canceled after 0s
Mac builds / wxiOS (push) Canceled after 0s
Mac builds / wxMac Intel C++17 (push) Canceled after 0s
Mac Xcode builds / iOS Simulator static (push) Canceled after 0s
Mac Xcode builds / macOS dynamic Release (push) Canceled after 0s
Mac Xcode builds / iOS static Debug (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Release x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Debug Win32 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Release arm64 (push) Canceled after 0s
MSW builds / wxMSW vs2026 DLL Release x64 (push) Canceled after 0s
MSW cross-builds / wxMSW 64 bits not compatible (push) Canceled after 0s
MSW cross-builds / wxMSW/Univ (push) Canceled after 0s
MSW cross-builds / wxMSW 32 bits (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
Update Documentation / Update Online Documentation (push) Canceled after 0s
Add SDL3 support and fix Wayland build issue.

See #26435, #26773.
2026-08-02 21:38:14 +02:00
Yannick DuchêneandVadim Zeitlin bd44befcc2 Use variadic template for wxMakeGuard() in the documentation
Make the declaration in the documentation header a valid C++
declaration.

Closes #26769.
2026-08-02 21:15:49 +02:00
PBandVadim Zeitlin cf9d191250 Don't build the MFC sample with CMake when linking CRT statically
The MFC sample unconditionally defines "_AFXDLL", which means linking
the MFC dynamically. However, this is incompatible with static CRT
linking.

Therefore, do not generate the MFC sample project when building
wxWidgets with CMake and linking the CRT statically, since the build
would have failed.

Closes #26770.
2026-08-02 21:15:49 +02:00
561bb292a1 Always create a GtkImageMenuItem for wxITEM_NORMAL items in wxGTK
wxMenu::GtkAppend() decided between GtkImageMenuItem and plain
GtkMenuItem based on mitem->GetBitmap().IsOk() at Append() time. This
breaks the common and explicitly supported idiom
menu->Append(id, label)->SetBitmap(bmp), where the bitmap is only
attached after Append() has already built the underlying widget: for
any non-stock id, GtkAppend() picked a plain GtkMenuItem, and the
later SetupBitmaps() call (from wxWindowGTK::DoPopupMenu(), triggered
whenever the menu is actually popped up) called
gtk_image_menu_item_set_image() on it, tripping the
GTK_IS_IMAGE_MENU_ITEM assertion and silently failing to attach the
bitmap.

Always build a GtkImageMenuItem for wxITEM_NORMAL (unless a stock
GTK id already provides one). An empty GtkImageMenuItem behaves
identically to a plain GtkMenuItem, so this has no effect on items
that never get a bitmap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-02 10:43:28 -07:00
Maarten Bent 78472fde85 CMake: Make sure SDL3 targets exist when using installed wxWidgets 2026-08-02 15:01:01 +02:00
Maarten Bent c70a840f3a CMake: Fix defining wxHAVE_WAYLAND_CLIENT
Fixes #26707
2026-08-02 14:48:42 +02:00
Andy VandijckandMaarten Bent 100eb6efc5 Add SDL3 support 2026-08-02 14:45:12 +02:00
Vadim Zeitlin adde4275d5 Merge branch 'ci-stop-using-ubuntu-18.04'
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK UTF-8 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxQt (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxX11 (push) Canceled after 0s
Unix builds / Ubuntu 26.04 wxGTK 2 (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Canceled after 0s
Unix builds / Ubuntu 20.04 wxGTK gcc 7 static compatible 3.0 (push) Canceled after 0s
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxDFB (push) Canceled after 0s
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Canceled after 0s
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Canceled after 0s
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Canceled after 0s
CMake builds / MSW/MSVC wxMSW (push) Canceled after 0s
CMake builds / MSW/Clang wxMSW (push) Canceled after 0s
CMake builds / macOS latest wxOSX Ninja (push) Canceled after 0s
CMake builds / macOS 14 wxOSX Xcode (push) Canceled after 0s
CMake builds / macOS 14 wxIOS (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 5.15 (push) Canceled after 0s
CMake builds / MSW/MSVC wxQt 6.10 (push) Canceled after 0s
Mac builds / wxMac ARM ASAN not compatible (push) Canceled after 0s
Mac builds / wxMac Universal C++14 (push) Canceled after 0s
Mac builds / wxiOS Simulator on Silicon Mac (push) Canceled after 0s
Mac builds / wxiOS (push) Canceled after 0s
Mac builds / wxMac Intel C++17 (push) Canceled after 0s
Mac Xcode builds / iOS Simulator static (push) Canceled after 0s
Mac Xcode builds / macOS dynamic Release (push) Canceled after 0s
Mac Xcode builds / iOS static Debug (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 DLL Release x64 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Debug Win32 (push) Canceled after 0s
MSW builds / wxMSW vs2022 Release arm64 (push) Canceled after 0s
MSW builds / wxMSW vs2026 DLL Release x64 (push) Canceled after 0s
MSW cross-builds / wxMSW 64 bits not compatible (push) Canceled after 0s
MSW cross-builds / wxMSW/Univ (push) Canceled after 0s
MSW cross-builds / wxMSW 32 bits (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
Update Documentation / Update Online Documentation (push) Canceled after 0s
Don't use Ubuntu 18.04 and its flaky PPAs for the CI builds any more.

See #26758.
2026-08-01 14:04:35 +02:00
MarkLee131andVadim Zeitlin 09cebab5cd Validate string lengths and item counts in cached help books
CacheReadString() took the length of a string straight from the .cached
file and passed len - 1 to wxCharBuffer. A stored length of 0 underflowed
to SIZE_MAX, so wxCharTypeBuffer allocated (SIZE_MAX + 1) bytes, i.e.
none, and then wrote its terminator at str[SIZE_MAX], which wraps on
64-bit to a write one byte in front of the block. The buffer was also a
byte shorter than the read that filled it, so the terminator was
overwritten and the wxString constructor went looking for one past the
end, and a large or negative length asked for a huge allocation or a read
through a null pointer.

Size the buffer as len so the terminator survives the read, as
ReadString() in zipstrm.cpp already does, reject a length that cannot
have come from CacheWriteString() or that exceeds the file, check the
read actually delivered the bytes, and build the string from the known
length rather than by scanning for a NUL.

The contents and index counts are used to reserve memory before anything
is read, so bound them against the file as well, and move the contents
loop to std::make_unique so the new early returns cannot leak, as the
index loop already does.

Fixes #26765.

Closes #26766.
2026-08-01 14:04:09 +02:00
MarkLee131andVadim Zeitlin a546a7c518 Reject TGA images whose declared size cannot fit the input stream
ReadTGA() sized both the image and its scratch buffer from the header's
width, height and bpp without comparing them against the input stream,
and never checked how much data the bulk reads actually returned. A
22 byte file declaring a 31232x16382 image at 24bpp therefore allocated
1.5 GB twice over, and, because a short read went undetected, LoadFile()
returned true and handed back an image of the declared size that the
file never contained.

Reject dimensions whose claimed image size cannot fit the stream before
allocating anything: uncompressed types must fit exactly, while the RLE
variants are allowed up to 128:1 expansion, since each packet costs
1 + pixelSize input bytes and yields at most 128 * pixelSize output
bytes. Also check LastRead() after the header read and after each of the
three uncompressed bulk reads, so that a truncated file is reported as a
failure instead of a success, as imagpcx.cpp has done since #26624;
DecodeRLE() already validated its own reads.

Fixes #26760.

Closes #26761.
2026-08-01 13:59:48 +02:00
alilieandVadim Zeitlin 060564a4bb Fix crash in wxOSX when toggling a toolbar item without a bitmap
Check that the bitmap is valid before doing anything with it.

Fixes #26763.

Closes #26768.
2026-08-01 13:51:15 +02:00
Yannick DuchêneandVadim Zeitlin 63f0ad1c6b Fix syntax errors in interface headers
Add missing semicolons which resulted in 2 declarations being merged
into a single one in the generated HTML.

Fix user-defined operator declaration syntax.

Fixes #26754.

Closes #26764.
2026-08-01 13:46:48 +02:00
Vadim Zeitlin 2782377d4f Switch Ubuntu 18.04 CI builds to newer Ubuntu versions
Don't use the old Ubuntu version, Ubuntu PPAs are simply too flaky to be
used.

Use the latest available Ubuntu image (26.04) for all builds except
wxDFB as libdirectfb-dev package is not available in this Ubuntu version
any longer, so use 24.04 for this job.

Remove special handling of Ubuntu 18.04 which is not needed any more.
2026-07-31 12:48:12 +02:00