misc fixes: memory leak, deprecated funcs, and code error
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
This commit is contained in:
parent
da9de873fb
commit
7c28a9a713
101
0001-misc-fixes-deprecated-func-memory-leaks-code-error.patch
Normal file
101
0001-misc-fixes-deprecated-func-memory-leaks-code-error.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From 35f849e92bc7e8fe10bd8836b8b3f84b3bf2321f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn>
|
||||
Date: Mon, 6 May 2024 15:45:43 +0800
|
||||
Subject: [PATCH] misc fixes: deprecated func, memory leaks, code error
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
|
||||
---
|
||||
UIControl/src/page1.cpp | 4 ++--
|
||||
UIControl/src/page2.cpp | 2 +-
|
||||
registeredQDbus/systemdbusregister.cpp | 8 ++++----
|
||||
registeredQDbus/systemdbusregister.h | 2 +-
|
||||
4 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/UIControl/src/page1.cpp b/UIControl/src/page1.cpp
|
||||
index 6b5d2ca..9736323 100644
|
||||
--- a/UIControl/src/page1.cpp
|
||||
+++ b/UIControl/src/page1.cpp
|
||||
@@ -157,11 +157,11 @@ void Page1::getUdiskPathAndCap()
|
||||
{
|
||||
diskInfos.clear();
|
||||
QProcess lsblk;
|
||||
- lsblk.start("lsblk -J");
|
||||
+ lsblk.start("lsblk", QStringList() << "-J");
|
||||
lsblk.waitForFinished();
|
||||
|
||||
QProcess lsblk2;
|
||||
- lsblk2.start("lsblk -JS");
|
||||
+ lsblk2.start("lsblk", QStringList() << "-JS");
|
||||
lsblk2.waitForFinished();
|
||||
QJsonArray arr1 = QStringToJsonArray(QString::fromLocal8Bit(lsblk.readAllStandardOutput())); //获取json类型的shell执行结果
|
||||
QJsonArray arr2 = QStringToJsonArray(QString::fromLocal8Bit(lsblk2.readAllStandardOutput()));
|
||||
diff --git a/UIControl/src/page2.cpp b/UIControl/src/page2.cpp
|
||||
index 8041012..78e2312 100644
|
||||
--- a/UIControl/src/page2.cpp
|
||||
+++ b/UIControl/src/page2.cpp
|
||||
@@ -161,7 +161,7 @@ void Page2::dealMakeFinish(QString status)
|
||||
bool Page2::mountDevice(QString target){
|
||||
|
||||
QProcess sync;
|
||||
- sync.start("sync");
|
||||
+ sync.start("sync", QStringList());
|
||||
sync.waitForStarted();
|
||||
sync.waitForFinished();
|
||||
|
||||
diff --git a/registeredQDbus/systemdbusregister.cpp b/registeredQDbus/systemdbusregister.cpp
|
||||
index 63ecf27..99db98c 100644
|
||||
--- a/registeredQDbus/systemdbusregister.cpp
|
||||
+++ b/registeredQDbus/systemdbusregister.cpp
|
||||
@@ -55,13 +55,13 @@ void SystemDbusRegister::MakeStart(QString sourcePath,QString targetPath){
|
||||
uDiskPath = targetPath;
|
||||
QFileInfo info(sourcePath);
|
||||
sourceFileSize = info.size()/1000000;
|
||||
- command_dd = new QProcess();
|
||||
+ command_dd = new QProcess(this);
|
||||
//指定输出语言
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
env.insert("LANGUAGE","en_US:en");
|
||||
command_dd->setProcessEnvironment(env);
|
||||
connect(command_dd,&QProcess::readyReadStandardError,this,&SystemDbusRegister::readBashStandardErrorInfo);
|
||||
- command_dd->start("bash");
|
||||
+ command_dd->start("bash", QStringList());
|
||||
command_dd->waitForStarted();
|
||||
QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress";
|
||||
command_dd->write(ddshell.toLocal8Bit() + '\n');
|
||||
@@ -93,7 +93,7 @@ bool SystemDbusRegister::unmountDevice(QString target)
|
||||
void SystemDbusRegister::MakeExit(){
|
||||
qDebug()<<"exit dd process";
|
||||
if(!command_dd) return ;
|
||||
- if(command_dd->Running){
|
||||
+ if(QProcess::Running == command_dd->state()){
|
||||
command_dd->kill();
|
||||
}
|
||||
return ;
|
||||
@@ -144,7 +144,7 @@ void SystemDbusRegister::finishEvent(){
|
||||
bool SystemDbusRegister::isMakingSucess()
|
||||
{
|
||||
QProcess lsblk;
|
||||
- lsblk.start("lsblk -JS");
|
||||
+ lsblk.start("lsblk", QStringList() << "-JS");
|
||||
// lsblk.waitForStarted();
|
||||
lsblk.waitForFinished();
|
||||
// qDebug()<<"lsblk output"<<lsblk.readAllStandardError();
|
||||
diff --git a/registeredQDbus/systemdbusregister.h b/registeredQDbus/systemdbusregister.h
|
||||
index 136ed98..3b6bffe 100644
|
||||
--- a/registeredQDbus/systemdbusregister.h
|
||||
+++ b/registeredQDbus/systemdbusregister.h
|
||||
@@ -41,7 +41,7 @@ class SystemDbusRegister : public QObject, protected QDBusContext
|
||||
Q_CLASSINFO("D-Bus Interface", "com.kylinusbcreator.interface")
|
||||
public:
|
||||
SystemDbusRegister();
|
||||
-// ~SystemDbusRegister();
|
||||
+ //~SystemDbusRegister();
|
||||
|
||||
Q_SIGNALS:
|
||||
void workingProgress(int);
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: kylin-usb-creator
|
||||
Version: 1.1.2
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: kylin-usb-creator
|
||||
License: GPL-3+
|
||||
URL: http://www.ukui.org
|
||||
@ -8,6 +8,7 @@ Source0: %{name}-%{version}.tar.gz
|
||||
Patch01: 0001-fix-version-of-kylin-usb-creator.patch
|
||||
Patch02: 0002-add-kylin-user-guide-of-kylin-usb-creator.patch
|
||||
Patch03: 0003-fix-clang.patch
|
||||
Patch04: 0001-misc-fixes-deprecated-func-memory-leaks-code-error.patch
|
||||
|
||||
BuildRequires: qt5-qttools-devel
|
||||
BuildRequires: qt5-qtscript-devel
|
||||
@ -26,9 +27,10 @@ BuildRequires: ukui-interface
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch01 -p1
|
||||
%patch02 -p1
|
||||
%patch03 -p1
|
||||
%patch 1 -p1
|
||||
%patch 2 -p1
|
||||
%patch 3 -p1
|
||||
%patch 4 -p1
|
||||
|
||||
%build
|
||||
%{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-usb-creator.pro
|
||||
@ -64,6 +66,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon May 06 2024 houhongxun <houhongxun@kylinos.cn> - 1.1.2-3
|
||||
- misc fixes: memory leaks, deprecated funcs, code errors
|
||||
|
||||
* Thu Aug 31 2023 yoo <sunyuechi@iscas.ac.cn> - 1.1.2-2
|
||||
- fix clang build error
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user