From f8c13e358904919eaadae4fb56729f40145ff75e Mon Sep 17 00:00:00 2001 From: lvgenggeng Date: Wed, 11 Dec 2024 19:46:51 +0800 Subject: [PATCH] fix: fix coredump in clearChildLayout function Signed-off-by: lvgenggeng (cherry picked from commit f7a3339018d378b9c19d69360dc2f494d6c31c0f) --- ...oredump-in-clearChildLayout-function.patch | 41 +++++++++++++++++++ deepin-draw.spec | 8 +++- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 0001-fix-coredump-in-clearChildLayout-function.patch diff --git a/0001-fix-coredump-in-clearChildLayout-function.patch b/0001-fix-coredump-in-clearChildLayout-function.patch new file mode 100644 index 0000000..1f97ff4 --- /dev/null +++ b/0001-fix-coredump-in-clearChildLayout-function.patch @@ -0,0 +1,41 @@ +From 669ef44f4f9ee32336b34eaa3b31869ce8a5bfc7 Mon Sep 17 00:00:00 2001 +From: lvgenggeng +Date: Wed, 11 Dec 2024 19:44:05 +0800 +Subject: [PATCH 1/1] fix coredump in clearChildLayout function + +Signed-off-by: lvgenggeng +--- + .../private/cattributemanagerwgt.cpp | 15 +++++---------- + 1 file changed, 5 insertions(+), 10 deletions(-) + +diff --git a/src/frame/AttributesWidgets/private/cattributemanagerwgt.cpp b/src/frame/AttributesWidgets/private/cattributemanagerwgt.cpp +index e706984..0adaab5 100644 +--- a/src/frame/AttributesWidgets/private/cattributemanagerwgt.cpp ++++ b/src/frame/AttributesWidgets/private/cattributemanagerwgt.cpp +@@ -161,18 +161,13 @@ Qt::Alignment CExpWgt::widgetAlignInWindow(const QWidget *w) + + void CExpWgt::clearChildLayout() + { +- for (int i = 0; i < _pCenterLay->count();) { +- auto item = _pCenterLay->itemAt(i); +- +- if (item->layout() != nullptr) { +- delete item->layout(); +- } else if (item->widget() != nullptr) { +- if (qobject_cast(item->widget()) != nullptr) { +- item->widget()->deleteLater(); +- } ++ while (_pCenterLay->count() > 0) { ++ QLayoutItem *pItem = _pCenterLay->takeAt(0); ++ if (nullptr != pItem) { ++ delete pItem; + } +- _pCenterLay->takeAt(i); + } ++ + foreach (auto p, _splines) { + p->deleteLater(); + } +-- +2.20.1 + diff --git a/deepin-draw.spec b/deepin-draw.spec index b5ff5dd..1f8f217 100644 --- a/deepin-draw.spec +++ b/deepin-draw.spec @@ -1,10 +1,11 @@ Name: deepin-draw Version: 5.10.6 -Release: 1 +Release: 2 Summary: A lightweight drawing tool for Linux Deepin License: GPLv3+ URL: https://github.com/linuxdeepin/%{name} Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Patch1: 0001-fix-coredump-in-clearChildLayout-function.patch BuildRequires: cmake BuildRequires: gcc-c++ @@ -29,7 +30,7 @@ Recommends: deepin-manual %{summary}. %prep -%autosetup +%autosetup -p1 %build # help find (and prefer) qt5 utilities, e.g. qmake, lrelease @@ -60,6 +61,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop %{_datadir}/mime/packages/deepin-draw.xml %changelog +* Wed Dec 11 2024 lvgenggeng - 5.10.6-2 +- fix: fix coredump in clearChildLayout function + * Wed May 17 2023 leeffo - 5.10.6-1 - update to 5.10.6 -- Gitee