qt6-bb10/tests/auto/corelib
Jøger Hansegård 8d367dec15 Add QUniqueHandle - a general purpose RAII wrapper for non-memory types
When interfacing with C-style APIs, such as the Windows API, resources
are often represented using handle objects. Lifetime management of such
resources can be cumbersome and error prone, because typical handle
objects (ints) do not give any help to release resources, and to manage
ownership.

Although std::unique_ptr can be retro-fitted with a custom deleter, and
helps transfer of ownership, it is inherently a pointer type. It can
therefore be clumsy to use with C-style APIs, particularly if the
invalid (uninitialized) handle value is not a nullptr. Also, the
std::unique_ptr does not work well when an allocating function returns
the handle as a pointer argument.

The QUniqueHandle addresses these issues by providing a movable only
value type that is designed as a RAII handle wrapper.

A similar handle wrapper exists in the Windows SDK, as part of the WRL
library. Unfortunately, this is Microsoft specific, and is not supported
by MINGW.

Since the QUniqueHandle is platform independent, it can be used also
with non- Microsoft platforms, and can be useful with other C-style APIs
such as FFmpeg or SQLite.

Pick-to: 6.6 6.5
Change-Id: Ibfc0cec3f361ec004febea5f284ebf75e27c0054
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-15 05:01:51 +01:00
..
animation QSequentialAnimationGroup: extend bindable property unit tests 2023-09-03 18:20:21 +02:00
global tst_qxp_is_virtual_base_of: disable all warnings for GCC < 10 2023-11-13 18:42:01 +00:00
io tests: skip setPermissions test if running as root 2023-11-03 11:00:11 +02:00
ipc QSharedMemory: fix attach() -> create() for non-legacy SystemV mode 2023-11-08 15:56:54 +01:00
itemmodels Q(Persistent)ModelIndex: use new test framework for op== 2023-11-13 17:35:54 +02:00
kernel JNI: Add convenience overloads for registerNativeMethods 2023-11-13 22:35:27 +01:00
mimetypes QMimeDatabase: update freedesktop.org.xml to shared-mime-info 2.3 2023-11-07 16:04:03 +01:00
platform Android: don't call delegates outside of the Activity 2023-11-10 21:57:11 +02:00
plugin tst_QFactoryLoader: remove unused member variable 2023-11-13 19:42:00 +01:00
serialization wasm: Fix test runner for asynchronous tests 2023-10-26 13:43:39 +02:00
text Improve tst_QStringConverter::encodingForName_data() 2023-11-13 19:42:01 +01:00
thread wasm: Fix test runner for asynchronous tests 2023-10-26 13:43:39 +02:00
time TestLib: provide helper functions to test relational operators 2023-11-13 16:35:54 +01:00
tools Add QUniqueHandle - a general purpose RAII wrapper for non-memory types 2023-11-15 05:01:51 +01:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00