From 70202f43293e7bb05f43f00a7f45c8aa6a297f3c Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu <fuzun54@outlook.com> Date: Wed, 19 Feb 2025 17:07:00 +0200 Subject: [PATCH] contrib: qtbase: ensure `QArrayDataPointer` `malloc()` and `free()` CRT match Having `free()` in the header file while `malloc()` in the source file is problematic, because Qt may use one type of CRT while the application that includes the header file may use another CRT (although we don't want to mix CRTs). --- ...r-use-Data-deallocate-instead-of-raw.patch | 34 +++++++++++++++++++ contrib/src/qt/rules.mak | 1 + 2 files changed, 35 insertions(+) create mode 100644 contrib/src/qt/0001-QArrayDataPointer-use-Data-deallocate-instead-of-raw.patch diff --git a/contrib/src/qt/0001-QArrayDataPointer-use-Data-deallocate-instead-of-raw.patch b/contrib/src/qt/0001-QArrayDataPointer-use-Data-deallocate-instead-of-raw.patch new file mode 100644 index 000000000000..b95fd16d7657 --- /dev/null +++ b/contrib/src/qt/0001-QArrayDataPointer-use-Data-deallocate-instead-of-raw.patch @@ -0,0 +1,34 @@ +From 37b0ea45fbdedbbbdfaa1734f6673e5db5f28cf1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Aur=C3=A9lien=20Brooke?= <aurelien@bahiasoft.fr> +Date: Tue, 28 Jan 2025 08:14:01 +0100 +Subject: [PATCH] QArrayDataPointer: use Data::deallocate() instead of raw + free() + +Be symmetrical with the Data::allocate() in the constructor. + +This is not strictly a no-op since we now call the exported symbol +QArrayData::deallocate() instead of inlining a free() call. However, it +allows future sized-free optimizations. + +Change-Id: I2ef00a897f56a32a0f1188f69f159834e6ca5b64 +Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> +--- + src/corelib/tools/qarraydatapointer.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h +index 6657d40cf90..9f641462a28 100644 +--- a/src/corelib/tools/qarraydatapointer.h ++++ b/src/corelib/tools/qarraydatapointer.h +@@ -107,7 +107,7 @@ public: + { + if (!deref()) { + (*this)->destroyAll(); +- free(d); ++ Data::deallocate(d); + } + } + +-- +2.48.1 + diff --git a/contrib/src/qt/rules.mak b/contrib/src/qt/rules.mak index 3c44998e035f..18b1dacec5af 100644 --- a/contrib/src/qt/rules.mak +++ b/contrib/src/qt/rules.mak @@ -54,6 +54,7 @@ qt: qtbase-everywhere-src-$(QTBASE_VERSION_FULL).tar.xz .sum-qt $(APPLY) $(SRC)/qt/0001-disable-precompiled-headers-when-forcing-WINVER-inte.patch $(APPLY) $(SRC)/qt/0001-Use-DirectWrite-font-database-only-with-Windows-10-a.patch $(APPLY) $(SRC)/qt/0003-Do-not-link-D3D9.patch + $(APPLY) $(SRC)/qt/0001-QArrayDataPointer-use-Data-deallocate-instead-of-raw.patch $(MOVE) ifdef HAVE_WIN32 -- GitLab