Commit Graph
77120 Commits
Author SHA1 Message Date
Vadim Zeitlin f6b4acf283 Change wxSizer::Detach(wxWindow*) to take wxWindowBase* instead
This function is called from wxWindowBase dtor to detach the window
being destroyed from the containing sizer and casting the pointer to the
object to wxWindow is UB because the object is not actually a wxWindow
any more by then.

Remove the cast and pass wxWindowBase pointer to wxSizer::Detach()
instead, as it doesn't need the full wxWindow anyhow.

Also document that any wxSizer-derived classes overriding Detach() will
need to be modified to follow this change.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin a0cf2f4b6c Initialize member of wxAuiNotebookPage
Ensure that we don't use uninitialized values of boolean member
variables when copying wxAuiNotebookPage objects, as this results in UB.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 5d10c50361 Remove cast resulting in undefined behaviour from wxDynamicCast()
Using static_cast<className*>(obj) when the object is not actually of
the given type is UB, so avoid it even if should be harmless in
practice, by simply omitting it: we only need "obj" to be a wxObject
here.

Note that this means that using wxCheckCast() or wxStaticCast() with a
type not deriving from wxObject is always UB, but there is not much that
we can do about it, so just document this explicitly.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 652866bd37 Reset tool bar pointer in wxFrameBase itself too
This is very similar to the parent commit and does the same thing for
m_frameToolBar, which is now managed by the frame itself, instead of
wxToolBar, as the other commit did for m_frameStatusBar.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 5156c40e1e Reset status bar pointer in wxFrameBase itself
Don't rely on wxStatusBar dtor resetting the frame status bar, this was
awkward (because the frame should be responsible for maintaining its own
state, instead of letting other classes do it) and resulted in UB when
the status bar was deleted from wxFrameBase dtor, as the cast of its
parent pointer to wxFrame was invalid by then, as the half-destructed
frame wasn't a wxFrame any more.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 816b02e3dc Remove cast from wxWindowBase to wxWindow in RemoveChild()
This cast was invalid, as the pointer could not be a valid pointer to a
wxWindow any more when this function was called from (child window)
wxWindowBase dtor.

It also was completely unnecessary, so just remove it.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 7a1bfc4f30 Exit with error if UBSAN detects any failures
By default, UBSAN doesn't stop the program and so the exit code is still
0 even if errors are detected, so set halt_on_error=1 in UBSAN_OPTIONS
to change this.

But also still rerun the tests normally, without halting, to detect all
UB occurrences if there is more than one instance of it.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 4875fa30b1 Add a CI job using UBSAN
Reuse one of the existing builds to enable UBSAN.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 5e0ad6759d Avoid signed multiplication overflow in wxDataInputStream::Read64()
Use shift instead of multiplication.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 0637f72e8d Avoid undefined behaviour due to unaligned pointer access
Code in UTF-16/32 conversions reinterpreted char pointers as pointers to
uint16_t/uint32_t which is invalid, in general, as the char pointer may
not be sufficiently aligned.

Stop doing this and reconstruct the 16/32-bit values from bytes
manually, taking care of the encoding endianness.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 8ddc73f202 Return correct constant from wxMBConvUTFXX::GetLength() on error
Even though wxCONV_FAILED and wxNO_LEN happen to have the same value, we
must return the latter and not the former from GetLength() to indicate
an error, according both to its comment and common sense.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 942ad9b89f Avoid undefined behaviour when handling events in wxWebSessionCURL
Inherit from wxEvtHandler as the first base class, not doing it results
in using a wrong pointer when handling events.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 1ee2480841 Avoid undefined behaviour in wxLongLong unit tests
There were several instances of signed integer overflow, avoid them by
either restricting the range or switching to unsigned.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 10181546ee Avoid undefined behaviour in signed integer shift in wxLongLong
Don't shift signed integer which can be negative, cast it to unsigned
first: as we shift it by 32 bits, it doesn't matter that it is not
sign-extended in this case.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 6dfa8d0a51 Avoid integer overflow in base64 test case
Don't multiply rand() by values that can result in overflowing the range
of int type, cast it to float and then convert back to int instead.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 1712ab5c61 Initialize wxSecretStore::m_valid in its dummy implementation
In build with wxUSE_SECRETSTORE==0 the stand-in implementation of
wxSecretStore was broken (instead of just being insecure) because
objects of this type were never valid, as we forgot to set m_valid.

Thanks UBSAN for flagging access to this uninitialized variable.
2024-10-19 16:43:05 +02:00
Vadim Zeitlin 210e8a7a1c Merge branch 'drop-longlongwx'
Always use wxLongLong and always use its "native" version.

See #24891.
2024-10-19 16:27:39 +02:00
Vadim Zeitlin 8d234aa5e9 Run macOS CI builds using macos-14 GitHub image
"macos-12" one is deprecated and will be removed soon.
2024-10-18 19:37:49 +02:00
Vadim Zeitlin 66fe889cab Merge branch 'qt-msw-clean'
Minor wxQt/MSW cleanup.

See #24886.
2024-10-18 19:34:41 +02:00
Blake-Madden 5f7d255be3 Add wxTextCtrl::SearchText() for MSW
Add new API allowing for more efficient searches in wxTextCtrl and
implement it in wxMSW only for now.

See #24756.
2024-10-18 19:32:58 +02:00
Ulrich Telle e5f95a3bb0 Document wxUILocale::UseLocaleName()
Under certain circumstances it can make sense to use a locale other than
the default user locale.

One example would be, if an application wants to use a UI translation
with an RTL language (like Arabic) on a non-RTL system. This wouldn't
work with the default locale, because the layout direction would be
wrong.

Currently setting a non-default locale can already be achieved via
wxLocale anyway. Therefore wxUILocale::UseLocaleName() should be made
public, to allow for less side effects than using wxLocale.

Closes #23972.
2024-10-18 19:31:50 +02:00
utelle 670ae7b1b0 Make macOS date picker control locale aware
Use the locale set using wxUILocale or the equivalent of the default "C"
locale (en-US) in the native date picker control instead of always using
the default user locale.

Closes #23956.
2024-10-18 19:27:34 +02:00
Scott Talbert fb04f7c2cc Update list of locales to install
The list of the languages to install the message catalogs for has to be
hardcoded in the bakefile currently, so update it to ensure that all the
available catalogs are installed.

Fixes #24880.

Closes #24887.
2024-10-18 19:26:32 +02:00
Martin Corino f07405d9a2 Remove "const" from wxAuiManager::LoadLayout() documentation
This was just a typo.

Fixes #24888.

Closes #24889.
2024-10-18 19:26:32 +02:00
Vadim Zeitlin 55cd1c6438 Keep wxLongLongNative and wxULongLongNative defined
Although these types were never supposed to be used outside of wx they,
of course, were, so keep them defined for compatibility.
2024-10-18 19:26:15 +02:00
Vadim Zeitlin 7aa6da06d0 Remove wxUSE_LONGLONG and always use wxLongLong_t
All supported platforms provide 64-bit integer types since many years,
so remove the legacy wxLongLongWx implementation and rename
wxLongLongNative to just wxLongLong and always compile it in.

Note that wxLongLong itself must still be kept for compatibility as it
has member functions, such as GetValue() or ToString(), that can be used
in the existing code.
2024-10-18 19:26:15 +02:00
Vadim Zeitlin 719169c87b Avoid harmless unused parameter warning in wxiOS header 2024-10-18 18:58:44 +02:00
Vadim Zeitlin a83d1b9843 Don't use wxLongLongNative in wxOSX code
This type is not supposed to be used directly, use wxLongLong instead.
2024-10-18 18:58:44 +02:00
Vadim Zeitlin fe162f5e2a Remove unused UL macro from wxMSW code
This was used for Borland compatibility which was removed back in
a6d4799de9 (Remove BCC-specific conditionally compiled code, 2020-10-13)
making this macro unnecessary and comment before it confusing because it
didn't make sense any more.
2024-10-18 18:58:44 +02:00
Vadim Zeitlin f64031fb59 Improve wxQt installation docs
Add a section for building wxQt with MSVC under Windows.

Also fix some typos and remove parts unnecessarily copy-pasted from
wxGTK instructions.
2024-10-17 00:38:21 +02:00
Vadim Zeitlin 80487333a4 Avoid MSVC warnings about shadowing member variables
Rename some local variables and parameters to avoid shadowing the member
variables.

Notably avoid shadowing QWidget::data in QWidget-derived class.

No real changes.
2024-10-17 00:29:08 +02:00
Vadim Zeitlin c4ae08f5f6 Remove redundant variable declaration
This resulted in a shadowing warning from MSVC.
2024-10-17 00:28:30 +02:00
Vadim Zeitlin 2f426ce9f8 Avoid harmless signed/unsigned comparison warning
Cast INT_MAX to unsigned long before comparing it with a variable of
this type.
2024-10-17 00:27:45 +02:00
Vadim Zeitlin dd6efcbac6 Avoid spurious "maybe uninitialized" MSVC warnings
Always initialize the variables that were previously only initialized in
the case when they were really used -- this doesn't cost much and avoids
MSVC warnings about these variables being possibly uninitialized.
2024-10-17 00:26:44 +02:00
Vadim Zeitlin 8698e760da Merge branch 'aui-serialize'
Provide a way to store AUI layouts in any custom format.

Closes #24225.

See #24235.
2024-10-16 21:14:25 +02:00
Vadim Zeitlin 819b205b8c Merge branch 'webresponse-getheaders' of https://github.com/dinkelacker/wxWidgets
Support multiple HTTP headers with same name.

Closes #24878.

See #24881.
2024-10-16 20:51:57 +02:00
Stefan Dinkelacker a163c31180 Fix queries of non-existent HTTP header strings 2024-10-16 07:27:21 +02:00
Paul Cornett fc2b6e64c3 Update pkg-config macros
From pkg-config-0.29.2, with hard tabs removed
2024-10-15 16:40:39 -07:00
Paul Cornett bd35a3cbc0 Use AC_C_BIGENDIAN
It has supported cross-compiling since version 2.2, almost 30 years ago
2024-10-15 16:32:16 -07:00
Paul Cornett ac0ea56404 Update config.{guess,sub} scripts to latest versions 2024-10-15 16:30:41 -07:00
Paul Cornett 69e9d6a81a Avoid invalid file name extensions from mime globs files
Discard patterns which are not of the form "*.ext"
2024-10-15 16:27:54 -07:00
Paul Cornett 9c5ddf3967 Request a more reasonable icon size from mime type lookup with GTK 2024-10-15 16:16:19 -07:00
Paul Cornett 41377dd48c Avoid invalid icon filename from mime type lookup with some GTK themes
If icon theme has only SVG files, lookup excluding SVG may result in a builtin icon using
a resource path which is not a valid file path. Avoid this by allowing SVG in this case.
See #23775
2024-10-15 16:13:24 -07:00
Vadim Zeitlin 83916edbab Update docks sizes before serializing them
This ensures that restoring the layout by recreating the same docks
recreates the same geometry as was used before, while without it the
panes just got their default initial sizes instead.

Ideal would be to avoid serializing the docks at all, as they can be
recreated automatically to accommodate the panes, but currently there is
no way to specify the size for the docks being recreated, so instead we
have to recreate it with the correct size ourselves when deserializing.
2024-10-15 23:34:43 +02:00
Vadim Zeitlin 51c5df6aa0 Always use DIPs when saving/restoring AUI layouts
Although this is unusual in wxWidgets API, it really makes sense to let
wxAuiManager perform the scaling, if necessary, instead of asking every
implementation of wxAuiSerializer and wxAuiDeserializer to do it on
their own, so pass the values as DIPs to the former and assume the
values returned by the latter are in DIPs too to make things just work
even on the platforms where DIPs are not natively used (i.e. wxMSW).
2024-10-15 23:34:43 +02:00
Vadim Zeitlin 9849124fae Provide a way to store AUI layouts in any custom format
Add wxAuiSerializer and wxAuiDeserializer classes and SaveLayout() and
LoadLayout() functions in wxAuiManager using them.

Show how these classes can be used to use XML for storing AUI layout in
the sample.

See #24225.
2024-10-15 23:34:43 +02:00
Stefan Dinkelacker 38c56c0b36 Fix newly introduced headers test
The format of the generated JSON by the httpbin service for
multiple headers with the same name differs between platforms.
These headers are sometimes put into a JSON array and sometimes
concatenated into a single comma-separated string.
2024-10-15 23:04:37 +02:00
Stefan Dinkelacker d1a9ec6dec Refactor wxWinHTTPQueryHeaderString()
Some code duplication can be removed by using
wxWinHTTPQueryAllHeaderStrings() in wxWinHTTPQueryHeaderString()
and returning ony the last queried header. This change also
increases consistency accross all webrequest implementations to
prefer the last header over the first in ambiguities.
2024-10-15 22:14:16 +02:00
Stefan Dinkelacker 3b2971e825 Improve test output on failure
The two strings that are compared should now be printed on
test failure.
2024-10-15 21:30:42 +02:00
Stefan Dinkelacker 1000d67c13 Add fallback to URLSession webrequest backend
Multiple HTTP headers with the same name are not supported by the
URLsession API. As a fallback, the last header is used instead.
2024-10-15 18:37:54 +02:00