Commit Graph
74371 Commits
Author SHA1 Message Date
Vadim Zeitlin 2b5dbd1ec5 Get rid of CppUnit boilerplate in wxString unit test
No real changes, just remove the completely useless StringTestCase and
use Catch macros directly instead of CPPUNIT_ASSERT wrappers.
2023-03-28 13:48:13 +01:00
Vadim Zeitlin f9c109957e Don't assert when using "%s" with invalid char in UTF-8 build
An existing unit test failed in UTF-8 build because using "%c" with an
invalid character triggered an assert due to trying to encode in UTF-8
(wchar_t)-1 that vswprintf() put into the returned buffer.

Fix this by not using the buffer contents at all if the function failed.
Note that although this seems to be harmless in wchar_t build, it was
still useless there, so don't make this specific to UTF-8 build.
2023-03-27 20:04:31 +02:00
Vadim Zeitlin b1a30e96ae Fix using dangling pointer in iterator dtor in UTF-8 builds
Destroying an iterator with a lifetime greater than that of the
associated string resulted in an invalid memory access due to using the
linked list of string iterators in the iterator dtor.

Fix this by clearing all the associated iterators when the string itself
is destroyed.

This fixes ASAN errors in wxDateTime::ParseDateTime() where "endTime"
const_iterator was destroyed after the destruction of the associated
"timestr" after successfully parsing the date.
2023-03-27 18:54:25 +02:00
Vadim Zeitlin fab541a8ff Fix another surrogate-related bug in UTF-8 build in wxString
This is similar to the fix in the previous commit and is needed for the
same reason.
2023-03-27 16:32:09 +01:00
Vadim Zeitlin aea45196ab Fix using wxStringOutputStream with surrogates in UTF-8 build
Under MSW, where wchar_t uses UTF-16, using wxString::length() was
wrong, as it could be smaller than the actual length of the wide
character string, e.g. 1 instead of 2 for a string containing a single
surrogate character, such as U+2070D used in wxStringOutputStream::Tell
unit test.

This makes this test pass under MSW too now.
2023-03-27 16:32:09 +01:00
Vadim Zeitlin d8cf6d03dd Use the length of the buffer instead of recomputing it again
Micro optimization: use the already known buffer length instead of
calling wcslen() to compute it again.
2023-03-27 16:32:09 +01:00
Vadim Zeitlin 7fba58c743 Fix a comment mentioning the now removed ANSI build
Speaking of ANSI build was confusing, so don't.
2023-03-27 16:32:09 +01:00
Vadim Zeitlin 133fd7faa1 Fix wxString::GetCache() compilation in UTF-8 DLL build with MSVS
Don't declare static Cache variable inside wxString declaration itself
because it is implicitly DLL-exported, due to the use of
__declspec(dllexport) for the entire wxString class, but thread-specific
variables can't be exported, so this resulted in a compilation error.

Avoid this by using a static thread-specific variable inside GetCache(),
which had to be moved out of line.
2023-03-26 17:56:55 +01:00
Vadim Zeitlin 52e5561ca5 Fix wxRegKey compilation in UTF-8 build
Use a macro to return a valid pointer to a wide string even in UTF-8
build, where we don't have a permanent wchar_t buffer to return a
pointer to.
2023-03-26 17:56:55 +01:00
Vadim Zeitlin 1869f9ec6f Use range for instead of iterators in unit test
No real changes, just simplify the code and ensure that iterating over a
string using range for loop works as expected.
2023-03-26 17:56:55 +01:00
Vadim Zeitlin eb4e75f8c3 Document that range for can be used for wxString iteration
This is simpler and better than using iterators.
2023-03-26 17:56:55 +01:00
Ian Day 73ad17db4e Fix dereferencing invalid iterator in wxString in UTF-8 build
Fix iterator going past end of string in PosLenToImpl, it can't become
end() as the end iterator can't be dereferenced.

Closes #23305.
2023-03-24 19:18:30 +01:00
Vadim Zeitlin ad29bdc6e4 Change one of the MSW CI builds to use UTF-8
Cover a previously unused build configuration in the CI: UTF-8 with MSVS
under MSW.
2023-03-24 19:18:30 +01:00
Vadim Zeitlin e733e28e7a Add a build using wxUSE_UNICODE_UTF8 to Appveyor CI 2023-03-24 19:18:30 +01:00
Vadim Zeitlin 0677d493df Add wxUSE_UNICODE_UTF8 to wx/setup.h
This option can also be used under MSW, so move it to the common setup.h
instead of having it in setup.h.in only.

Also do the same thing for wxUSE_UTF8_LOCALE_ONLY, even if it's less
clear if this one is really useful in non-Unix environment.
2023-03-24 19:18:30 +01:00
Vadim Zeitlin 0f0ac39800 Don't claim that wxUSE_UNICODE_UTF8 is Unix-specific
It can be used under MSW too.
2023-03-24 19:17:59 +01:00
Vadim Zeitlin 5cc2983bee Test UTF-8 build variant with ASAN too
To avoid adding yet another build, enable UTF-8 and ASAN for the
existing C++20 build.
2023-03-24 19:17:59 +01:00
Vadim Zeitlin b01faaafa5 Merge branch 'webview_webkitgtk_config' of https://github.com/TcT2k/wxWidgets
WebKit2GTK: Add wxWebViewConfiguration and child window support.

See #23374.
2023-03-24 18:09:27 +01:00
Paul Cornett 2d32b8cdd8 Fix GSource leak from idle processing
It is apparently not safe to call gtk_events_pending() from the idle
callback, as it can result in GLib failing to properly dereference some
GSource objects.

This leads to increasingly large amounts of CPU time being spent in GLib
processing internal lists of these GSource objects. So avoid calling
gtk_events_pending(), as it is not strictly necessary because our idle
source will remain installed if wxIdleEvent::RequestMore() is used, and
if no events have arrived the idle callback will be invoked again.

Closes #23364.

See #23368.
2023-03-24 18:08:41 +01:00
Tobias Taschner 49f7af6100 Add navigation action for webkitgtk2 backend 2023-03-24 15:10:42 +01:00
Tobias Taschner 1970806829 Remove unused GTK WebView new window handling code 2023-03-24 15:10:42 +01:00
Tobias Taschner 8038195952 Unify entries in wxWebViewEvent table 2023-03-24 15:10:42 +01:00
Tobias Taschner e15a1ac18e Add wxWebViewWindowFeatures and event
This replaces the previously implemented wxWebViewWindowInfo.

It explicitly breaks the previous API to enable WebKitGTK
integration and to make the usage in application code less error prone.

A new event wxEVT_WEBVIEW_NEWWINDOW_FEATURES is added to allow
access to the window features and the child web view.
2023-03-24 15:10:21 +01:00
Tobias Taschner 8d0685ee08 Add wxWebViewConfiguration support for webkitgtk2
Allows setting some webview settings which would be unavailable after
creation.
2023-03-24 15:10:20 +01:00
Tobias Taschner 42ca043d54 Add wx_check_webkit_version()
This function allows for runtime checks of the webkit version
2023-03-24 09:45:28 +01:00
Tobias Taschner 86ba6f979a Implement wxEVT_WEBVIEW_WINDOW_CLOSE_REQUESTED
Implement wxEVT_WEBVIEW_WINDOW_CLOSE_REQUESTED for webkitgtk2.
2023-03-23 09:34:17 +01:00
Dan Gudmundsson 23ccdb23c8 Improve and document wxGLCanvas::CreateSurface()
This function must be called to be able to re-create the EGL drawing
surface after the window layout have changed, such as after a reparent
of the canvas or of it's grandparents.

Make it suitable for use in this case by re-creating the surface if
there already was one and document this function to make it part of the
public API.

Closes #23366.
2023-03-22 18:41:27 +01:00
Ryan Norton e1c3962aa9 Improve wxURI parsing
- Update parsing IPvX addresses to follow RFC and add many more tests.
- Rework authority parsing for RFC edge cases.
- Fix a couple of other extreme edge cases.

Closes #23360.
2023-03-22 18:35:45 +01:00
Blake Madden 11358d7dcc Don't expose internal strings to translation in samples
Remove _() around string which it doesn't make sense to translate in the
sockets sample.

This doesn't actually change anything as this sample doesn't use
translations in any case, but still show a good example.

Closes #23362.
2023-03-22 18:26:05 +01:00
Artur Wieczorek 35a8d0f908 Fix building wxPropertyGrid with v3.0 compatibility enabled
Closes #23369.
2023-03-22 17:07:41 +01:00
Vadim Zeitlin eaa326a93d Temporarily disable deprecation warnings in webkit2gtk code
Version 2.40 deprecates a few functions used in wxWebViewWebKit
implementation, resulting in new warnings breaking CI builds.

Avoid these warnings by suppressing them for now before the real
solution, involving using the new functions if they're available, can be
implemented.

See #23367.
2023-03-22 12:19:39 +01:00
Adrian Lopez 0331057aba Fix wxPropertyGrid tab traversal under wxGTK
Tab traversal from a wxPropertyGrid didn't work across wxPanel
instances or when the property grid was followed by a static control
such as wxStaticText due to implementing it "manually".

Fix this by using Navigate() to implement this instead, and just keep a
SetFocus() hack which is still needed for wxGTK.

Fixes #23354.

Closes #23358.
2023-03-18 21:00:48 +01:00
Tobias Taschner 1edb38b548 Fix MSW lib names for ARM64 with CMake build
Any 64 platform had the added _x64 suffix. This will now be _arm64
when building for ARM64.

Fixes: #23347

Closes #23355.
2023-03-18 20:58:15 +01:00
Vadim Zeitlin f82bd9ea67 Merge branch 'webview_configuration' of https://github.com/TcT2k/wxWidgets
Add wxWebViewConfiguration.

See #23349.
2023-03-18 20:55:39 +01:00
Vadim Zeitlin 9ad79ba03a Merge branch 'thread-fixes'
Fix TSAN errors in thread unit tests.

See #23340.
2023-03-18 20:53:10 +01:00
Stefan Csomor 9c8dfe5b2a Wrap wxStaticText contents under Mac too
Instead of just clipping the label, wrap it. This is more consistent
with wxMSW and wxGTK and also generally more useful.

See #23345.

Closes #23341.
2023-03-18 20:51:28 +01:00
Vadim Zeitlin c202385f3a Add a note about icons to wxMessageDialog documentation
Explain that the requested icon is not always used.

Closes #23353.
2023-03-18 20:50:10 +01:00
Vadim Zeitlin 28e0a7e01d Fix using Wine in wxMSW cross-CI workflow
Since 8.0~repack-3 version of the Debian Wine package, installing wine64
doesn't create wine64 symlink any more and wine package needs to be
installed to do it, apparently due to the changes done to fix
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029536

This resulted in the tests not running any more because we used wine64
for running them. Just use "wine" now and install wine package, as it
should still run 64-bit binaries just fine.
2023-03-18 18:00:36 +01:00
Paul Cornett 30181a9dd9 Fix handling of duplicate -arch or -framework options
See #23356
2023-03-17 11:56:59 -07:00
Tobias Taschner 235e71ef28 Edge: Hold environment in configuration 2023-03-17 11:58:35 +01:00
Tobias Taschner 05c77757e2 Edge: Send an error event for various API errors
These errors are rare, but can happen. This way user code can react to
Previously they where just logged.
2023-03-17 09:29:46 +01:00
Tobias Taschner b48e5b4c66 Add wxWebViewConfiguration::SetDataPath()
While currently only implemented for the Edge backend GTK webkit could
also make use of such a setting.

Fixes: #19317
2023-03-17 09:29:46 +01:00
Tobias Taschner dd4d5c75af Add wxWebViewConfiguration
In 40ff38b63b wxWebView::GetNativeConfiguration() was
added which isn't suitable if multiple wxWebViewEdge instances are created with
different options (as they must share the same options). To prevent such errors
the previous method is replaced by the new class wxWebViewConfiguration which
can be shared between various wxWebView instances.

This explicitly breaks API to improve usage.

In the future the new class could also enable a good way to wrap various
common options/configurations available via native API.
2023-03-17 09:29:46 +01:00
Artur Wieczorek 8ad0f52da0 Include header with basic wxPGProperty classes in main wxPG header
This header shouldn't be included here but it was included here in
the previous versions of wxPG and user apps can be broken by removing it.
2023-03-15 19:10:02 +01:00
Artur Wieczorek a07d17a8a4 Implement comparison operators for bitmasks with enum classes
Implementing bitmask-to-int comparison operators can help
in migrating from int-based bitfields to enum class bitmasks.
2023-03-15 19:02:29 +01:00
Vadim Zeitlin 8b2e010841 Stop using macro-based array in wxThread unit test
Use vector of unique_ptr instead.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin b3ff1f3e61 Fix data race in wxGetTimeZone()
We could return a wrong value from this function if two threads called
it simultaneously, as gmtoffset value could be returned without DST
adjustment in one of them. And just accessing it from two different
threads without synchronization was a data race on its own.

Fix both problems by using an atomic int for it and taking care to only
set it to the correct value.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin dd8935b07d Fix waiting for threads to exit in wxCondition unit test
Using sleep was not only fragile but also resulted in tons of TSAN
errors, so replace it by the similar approach to the one which was
already used to wait for the threads to start up.

This is horribly inefficient but we don't care about this in the test
and, at least, this does ensure that the threads exit before it ends.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin 0bc7aed861 Fix data race when resuming the thread in Delete()
Changing the state without a lock was a bug and resulted in a TSAN
error.

Fix this by moving the call to Resume() inside the region holding the
lock.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin 59312f5ba0 Fix possibly fatal race condition when calling OnDelete()
This function could be called on an already deleted object, which could
result in a crash, and always resulted in a TSAN error.

Fix this by calling it before releasing the internal lock, which
prevents this from happening, but will result in a deadlock if this
function is overridden to do something requiring any lock held by the
thread.

This is not ideal, but still seems to be like a lesser evil.
2023-03-13 01:17:23 +01:00