... removing the custom scope-guard which was .dismiss()ed too early
(the allocation of 'c' could theoretically fail, and the old code
would leak the slot object in that case; nothing we're generally
guarding against in Qt, but it's a nice drive-by gain, probably shuts
up static checkers, and makes readers wonder less about the lifetime
of the slot object).
As mentioned in the patch porting QObject::connectImpl(), leave the
unique_ptr out of the function's signature, see there for rationale
(key-word: tail-callability).
Pick-to: 6.6 6.5
Change-Id: Ib90371b9768a72fd62d080b71eef2c82f851db81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This gets rid of the smell that one destroyIfLastRef() call guarded
against nullptr while the other one did not.
Don't change the function signatures, as passing by unique_ptr, while
making the transfer of ownership clear, makes it impossible to call
the function as a tail-call: Non-trivially-copyable arguments live in
the caller's stack frame and the caller has no idea whether the object
was moved from in the callee or not, so it needs to run the dtor,
which prevents this from being tail-callable.
Passing .release(), OTOH, makes it obvious that the unique_ptr is
nullptr afterwards, so leaves the door open for tail-calling.
However, the QObjectPrivate::connectImpl() wasn't, and continues to
not be, a tail-call. Investigating why, while intriguing, is for
another patch (and much more important for the template wrappers of
these functions than then one out-of-line function we're dealing with
here).
Pick-to: 6.6 6.5
Change-Id: Ib951ed2a2b622d70cb12ddbf01c83ec56b1ce70d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... so it can use the new QMetaCallEvent() ctors taking that type.
As a consequence, the slot object ref-count is now no longer touched
on the way into the meta-call event (was: upped in QMetaCallEvent
ctor, then downed in QScopeGuard).
Pick-to: 6.6 6.5
Change-Id: Id9bd157792458a3834809c23e94ca5f504f7abd1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This makes it clear who is responsible for obtaining additional strong
reference to the slot objects, because these functions no longer do.
Pick-to: 6.6 6.5
Change-Id: I39187e3c441d8f82d50d907731f1cbdfb2a95b9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When, like in tst_QFactoryLoader::extraSearchPath(), where asan caught
it, or, presumably, on re-creation of a QGuiApplication with a
different QT_QPA_PLATFORM_PLUGIN_PATH, setExtraSearchPath() is called
with a different path than before, then it would leak QLibaryPrivate
objects in the call to libraryList.clear().
Fix by adding QLibraryPrivate::Deleter and holding the objects in
unique_ptr<QLibraryPrivate, Deleter> instead of as raw pointers. This
statically guarantees we're not leaking these objects anywhere else in
QFactoryLoader.
Change the name of the container from libraryList to libraries to catch
any unported users, incl. in older branches.
Since libraryList is now a std::vector (QList cannot hold move-only
types), statically assert that it was never attempted to be copied or
moved, even in older branches, with Q_DISABLE_COPY_MOVE().
Amends ddba24535f.
Not picking to 6.4 and 6.3, as they are closed at this point.
Pick-to: 6.6 6.5
Fixes: QTBUG-115286
Change-Id: I6d1272622b12c505975cc72f9aba0d126d2817e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It doesn't make sense to disturb users with the policy warning if they
don't specify Android paths. Suppress the policy check if Android
paths are not set for the target.
Fixes: QTBUG-115119
Pick-to: 6.6
Change-Id: Ice9d0459c01feb505857133bb942b1b6e775e55a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QtSystemMsg has been an alias to QtCriticalMsg since Qt 4 times,
probably because of the misleading name. Let's formally deprecate
the enum now, so that it at one point (Qt 7?) can be finally removed.
Change-Id: I385b62a77ceb66f75f318a00a73ea5e7333bf4f1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
These pages are designed as tutorials, so
they can be \page instead of \example.
Also, reorganized the tutorials, moving them out
of the testlib manual, into several qdoc files.
Task-number: QTBUG-115248
Pick-to: 6.5 6.6
Change-Id: I2cbd66ecc1082ecc9d3d1742b621ee009daf1031
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Exclude TUs that cause problems in a build where all of QtWidgets's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.
Of course, this is just a snapshot, with my configuration: GCC 13,
Ubuntu 20.04, -developer-build, C++23, -sctp.
Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: I6a445701e2ac41d67a3ec69715b7bf6ed5ec65f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Exclude TUs that cause problems in a build where all of QtCore's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.
Of course, this is just a snapshot, with my configuration: GCC 13,
Ubuntu 20.04, -developer-build, C++23, -sctp.
Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: If33a485b697f60a2f4d6198f0798c953fa47af51
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
As a drive-by, re-use the result from the first QFile::exists
check.
Pick-to: 6.6
Change-Id: I6b36b165ba3d1f82c9b4be18d44a671f71e8507e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When we reset the theme so that icons should be provided by the
system theme, then reset the search paths to the system-provided
paths as well. Otherwise we'll keep looking for the system theme
in user-provided search paths, which can't work.
Pick-to: 6.6
Change-Id: I10bcb404db9924e038f6fdc8970e53bbb69ac7d1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Amends a452e22546. No new tests, existing
tests fails when QPlatformTheme returns a QIconEngine implementation
that provides the tested icons. However, the existing test fails when
the platform icon engine provides and address-book-new icon, and depends
on the order of test functions, as the name() test function modifies the
global theme name and search path. Fix those issues in the test.
Pick-to: 6.6
Change-Id: Ie1c1d14f08fad5e906296bab662df5cfacdbbf07
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
perror does not support string formatting. The problematic code is in VxWorks ifdef so this error was not breaking the other targets compilation.
Change-Id: I44e5d247bfa76815c81f0d122f0e34b75538dfa9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Looping over the entries had a typo in it and was quite unnecessary,
as it just made a fresh copy of a list we already had.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I0f3023b06163e5854d425d816e465785cda5fc91
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
If the path where Qt sources are located has 3rdparty in it we skip
headers processing since all headers are treated as 3rdparty.
Use path relative to the source directory when indentifying the 3rdparty
header files using regex.
Fixes: QTBUG-115324
Pick-to: 6.5 6.6
Change-Id: If97328cb9a9ece01d43c56022f4613da9b29c03f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use QT_NO_CONTEXTLESS_CONNECT to disable 3-arg connects which are
considered dangerous.
Change-Id: I0ac711491de60e0eeaca9edb60715eafe9da841a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
- Add a constructor
- Initialize members in-class
- Reorder the data members so as not to waste space between them, now
all the padding is at the end
Change-Id: Ic88200fbff049615a6a43e322e724cf619fc3cdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead use composition by using a container member; inheriting from
containers has a couple of issues:
- containers (STL and Qt) don't have virtual destructors, which means
that deleting via a pointer to the base-class would be troublesome
- as it turns out, inheriting from containers, QList in this case,
in an exported derived-class could lead to binary-incompatibility
issues (see linked bug report)
Drive-by change:
- group all private members in one place
- make timerInsert() private, nothing should use it from outside the
class anyway
Change-Id: I69843835d8c854fa4b13e8b4ba3fb69f1484f6a6
Fixes: QTBUG-111959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Use removeIf(), easier to reason about than removing from the list
during iteration
- Return true only if any timers were actually unregistered
- Assert in QObject::event() that if the list returned by
eventDispatcher->registeredTimers() isn't empty, then
eventDispatcher->unregisteredTimers() returns true
Change-Id: I739a3865b7524a7aab3ff0227e6a060ed98d6191
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They have no preconditions and cannot throw.
As a drive-by, merge the definition of isEmpty() into its declaration.
Pick-to: 6.6
Change-Id: Ifffa0d4cb2a285bb802d39d10a757be9c31cfae1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
We were not ref'ing or deref'ing the slot object in the various places
that owned it. So, if, in the end, the QHostInfoResult object didn't
call the slot we would leak the slot object.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-115263
Change-Id: I45f43756c7589470045d97b59257ccfd85a325b7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Extract Method create_impl() with all the stuff that doesn't depend on
create()'s template arguments, which will reduce compile time and
amount of generated code.
Pick-to: 6.6
Change-Id: I9d8f59c168873ac3527b570ef6142079824061cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
... removing a ### comments to that effect.
Pick-to: 6.6
Change-Id: I635ca9593ec72a66d328ff6de61cd311c1b4e89f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Use it in QMetaCallEvent, to have some automatic test coverage. Other
code that might benefit has undergone changes since 5.15, so will be
ported one-by-one to avoid conflicts on cherry-picks.
Pick-to: 6.6 6.5
Change-Id: I566bab1803e3675f75a9fdf294a4b0f047d21c11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Using QT_REQUIRE_CONFIG results in a static_assert if the xmlstream
feature is not available. This is a SiC change, as the user has
no reasonable ways to guard against it.
Fix it by using
if QT_CONFIG(xmlstream)
instead.
This commit amends 7337474d04
Pick-to: 6.6
Change-Id: I0c55e4cff06157743c05a543a092f9be1eb67c2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The autogenerated list of overviews was adding the \group command which
included all the groups instead of overviews.
The idea here is to categorize the overviews later on once we have
the list of all overviews.
Task-number: QTBUG-114762
Pick-to: 6.5 6.6
Change-Id: I3cf53886be277abc86b5ec54d399cd6933fbe882
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Allocate participating threads and objects on the stack, not the heap.
As a drive-by, port from QList to C arrays (never use a
dynamically-sized container for statically-sized data™).
Code predates the public history, all active branches are affected.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If8def658c1c7b505074938d637e78ad2d1f9fd57
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... so that everything that requires argv is done first.
Also introduce a new variable, argc, for sizeof...(Args) + 1.
This will allow us to apply Extract Method to the tail end, which now
no longer depends on argv or Args.
As a drive-by, port from std::array to C arrays so we can use
automatic array size deduction: There's still no such thing as partial
CTAD (certainly not in C++17), so if we wanted std::array to deduce
the size, we'd also need to let it deduce the type; and we don't want
to add an ugly cast to the nullptr). C arrays, OTOH, can deduce the
size while fixing the type since K&R C.
Pick-to: 6.6
Change-Id: I5a694d4f4d41974eb4b1075ff030bbef902ed492
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Like in 9f8449a054, for
doubleProxySelectionSetSourceModel(), the sortStable() test also
leaked _everything_. Fix in the same way, by allocating model and view
on the stack intead of the heap.
With this patch, tst_QSortFilterProxyModel is now asan-, but not
ubsan-clean (and, because of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110704, asan still
reports a leak in cp-demangle.c, which should be™ gone once we fix the
rest of QTBUG-99563).
Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-115264
Change-Id: Ic0e833d7336435e324457f9d9667ee8573a7dafc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Surprisingly, this wasn't mentioned in the detailed description at all.
Users would need to click on the link for the example in the "See also"
section and then read through it to find any mention of how tool bars
are created.
Pick-to: 6.2 6.5 6.6
Change-Id: I9db23b475009072f34defab38b6d6200a45f2f35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Bridge QAccessibleSelectionInterface that was introduced
in commit 9d16d5e224 to
UIA's ISelectionProvider and ISelectionProvider2 interfaces
by extending the existing WindowsUiaSelectionProvider
to make use of the QAccessibleSelectionInterface.
Also make use of that interface to implement handling
for the ISelectionProviderItem interface methods when
an object has a parent that implements the
QAccessibleSelectionInterface.
Sample use from NVDA's Python console [1] with this
commit in place:
1) start NVDA
2) run the interview example (examples\widgets\itemviews\interview\interview.exe)
3) select "Item 1:0", "Item 2:0" and "Item 3:0" by left-clicking
on "Item 1:0" in the left view, then shift+clicking on "Item 3:0".
4) press Numpad_insert+control+z to start the NVDA Python console and
capture snapshot variables
5) query and use the interfaces using NVDA's Python console:
>>> import UIAHandler
>>> selectionpattern2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2)
>>> selectionpattern2.CurrentFirstSelectedItem.CurrentName
'Item 1:0'
>>> selectionpattern2.CurrentLastSelectedItem.CurrentName
'Item 3:0'
>>> selectionpattern2.CurrentItemCount
3
>>> selectionitempattern = focus.UIAElement.GetCurrentPattern(10010).QueryInterface(UIAHandler.IUIAutomationSelectionItemPattern)
>>> selectionitempattern.CurrentIsSelected
1
>>> selectionitempattern.RemoveFromSelection()
0
>>> selectionitempattern.CurrentIsSelected
0
>>> selectionpattern2.CurrentItemCount
2
>>> selectionitempattern.Select()
0
>>> selectionitempattern.CurrentIsSelected
1
(Note that calling selectionitempattern.AddToSelection
in that example would also unselect all other currently
selected entries, because the underlying implementation
has a selection mode of QAbstractItemView::SingleSelection
set in QAccessibleTree::selectRow, which gets called
from QAccessibleTable::select via QAccessibleTableCell::selectCell.)
[1] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole
Change-Id: I7003bae5bbcfd5c685620bf710781165ed70f106
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Support UIA's ISelectionProvider2 interface [1]
in addition to ISelectionProvider.
The ISelectionProvider2 interface inherits from the
ISelectionProvider interface.
A follow-up commit that will introduce bridging the
QAccessibleSelectionInterface, introduced in commit
9d16d5e224.
While at it, also reserve space for the amount
of children in the QList in QWindowsUiaSelectionProvider::GetSelection
before inserting them one by one, to avoid reallocations.
Sample use of the ISelectionProvider2 interface from NVDA's
Python console [2] with this commit in place:
1) start NVDA
2) run the gallery example (examples\widgets\gallery\gallery.exe)
3) click on the "Style" listbox at the top
4) press Numpad_insert+control+z to start the NVDA Python console and
capture snapshot variables
5) query and use the interface using NVDA's Python console
>>> import UIAHandler
>>> iselection2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2)
>>> iselection2.CurrentItemCount
1
>>> iselection2.CurrentFirstSelectedItem.CurrentName
'windowsvista'
>>> iselection2.CurrentLastSelectedItem.CurrentName
'windowsvista'
[1] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider2
[2] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole
Change-Id: I43642e9e39b63c65da97af976cc322a8e5868170
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Because we didn't handle Negotiate in the "Start" phase during
handleAuthenticateChallenge, we would not emit the auth signal before
our second attempt, assuming the server prompts us for one.
Emitting the authenticationRequired signal is needed for users
to be able to set the Service Principal Name (SPN) option.
Alternatively, username and password if not relying on Single sign-on.
Done-by: Emil Wipplinger <>
Pick-to: 6.6 6.5
Fixes: QTBUG-114559
Change-Id: I833c08dfeda36a6548c5ad6b8af4b8aa9d644c45
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Remove a stray qDebug() statement, that was forgotten in the source.
Pick-to: 6.6 6.5
Change-Id: I5c413b4356f05570474fa2a0d6ad661785c818b0
Reviewed-by: Liang Qi <liang.qi@qt.io>
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.
Pick-to: 6.6
Change-Id: If9140499e5dccf0065a4826831d3b83813910318
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.
Pick-to: 6.6
Change-Id: I2cf5dc275c3272151efd655a4fa85936942c5708
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Amends commit fa296ee1dc to implement
MyObject::startup(), mark it void (its return was ignored) and flag
its static wrapper as [[maybe_unused]] to calm a compiler warning.
As a drive-by, fix indentation of the class definition.
Change-Id: I3918bf8a4625a7e2b4e6d4e0cbfa68a337115865
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>