45 lines
1.7 KiB
Diff
45 lines
1.7 KiB
Diff
From ae26631a045b39aeb760ada4c1cfd98783599fda Mon Sep 17 00:00:00 2001
|
||
From: yuanxing <yuanxing@kylinsec.com.cn>
|
||
Date: Fri, 25 Aug 2023 13:47:13 +0800
|
||
Subject: [PATCH 4/5] 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.33.0
|
||
|