kiran-control-panel/0001-fix-wallpaper-don-t-call-xmlWriter-if-system-backgro.patch
yuanxing b7a3fc65f7 fix(wallpaper):change the system wallpaper xml search path to kiran,and solve the segmentation fault when system xml not exists
- 修改系统壁纸xml文件搜索路径为kiran,并解决该文件不存在时带来的段错误
2023-08-25 14:02:44 +08:00

45 lines
1.7 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 2dc6afb3447969964b51c3d02986796f0d7bd77d Mon Sep 17 00:00:00 2001
From: yuanxing <yuanxing@kylinsec.com.cn>
Date: Fri, 25 Aug 2023 13:47:13 +0800
Subject: [PATCH] fix(wallpaper):don't call xmlWriter if system background xml
not exists to solve segmentation fault
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 当系统系统壁纸xml文件不存在时不调用xmlWriter函数防止段错误
---
.../wallpaper/widget/xml-management/xml-management.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/plugins/appearance/src/pages/wallpaper/widget/xml-management/xml-management.cpp b/plugins/appearance/src/pages/wallpaper/widget/xml-management/xml-management.cpp
index 8d174ab..385eb9e 100644
--- a/plugins/appearance/src/pages/wallpaper/widget/xml-management/xml-management.cpp
+++ b/plugins/appearance/src/pages/wallpaper/widget/xml-management/xml-management.cpp
@@ -38,8 +38,8 @@ void XmlManagement::loadXmlFiles()
if (!file.exists())
{
KLOG_DEBUG() << "local xml file no exist";
- xmlReader(SYSTEM_WALLPAPER_FILE);
- xmlWriter();
+ if (xmlReader(SYSTEM_WALLPAPER_FILE))
+ xmlWriter();
}
xmlReader(localFile);
}
@@ -209,6 +209,11 @@ void XmlManagement::xmlUpdate(QList<QMap<QString, QString>> updateList)
{
QString localFile = QString("%1/%2").arg(QDir::homePath()).arg(LOCAL_WALLPAPER_FILE);
QFile file(localFile);
+ if (!file.exists())
+ {
+ KLOG_DEBUG() << localFile << " doesn't exists!";
+ return;
+ }
if (!file.open(QFile::WriteOnly | QFile::Text))
{
KLOG_DEBUG() << "open " << localFile << " failed!";
--
2.27.0