109348 【备份还原4.0.14】选择在移动设备上备份的系统进行系统还原时,在到还原中的步骤时,拔出移动设备,进度卡在100%不动

This commit is contained in:
zhaominyong 2022-03-09 17:19:49 +08:00
parent 5db97cf5f4
commit 8dbd01c6d5
8 changed files with 60 additions and 39 deletions

View File

@ -17,6 +17,7 @@ UDiskDataBackupProxy::UDiskDataBackupProxy()
UDiskDataBackupProxy::~UDiskDataBackupProxy()
{
m_isForce = false;
}
/**
@ -337,6 +338,7 @@ bool UDiskDataBackupProxy::backupDataToUdisk()
if (m_bCancel)
return ;
m_isForce = false;
m_isFinished = true;
if (result) {
m_backupPoint.m_state = BACKUP_PARSE_STATE_SUCCESS_STRTING;
@ -378,19 +380,23 @@ bool UDiskDataBackupProxy::backupDataToUdisk()
*/
bool UDiskDataBackupProxy::checkDestDirExists()
{
QDir dir(m_backupWrapper.m_prefixDestPath);
if (!dir.exists()) {
qCritical() << QString("dstDir %s is not exist!").arg(m_backupWrapper.m_prefixDestPath);
if (m_p)
m_p->stop();
return false;
}
if (!m_isFinished)
{
QTimer::singleShot(1*1000, this, &UDiskDataBackupProxy::checkDestDirExists);
// 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
return false;
}
if (Utils::isDirEmpty(m_backupWrapper.m_prefixDestPath) && m_p != nullptr) {
qCritical() << QString("dstDir %s is not exist!").arg(m_backupWrapper.m_prefixDestPath);
m_p->stop();
// 10s钟后如果还没有退出则强制退出
QTimer::singleShot(10*1000, this, &UDiskDataBackupProxy::checkDestDirExists);
m_isForce = true;
} else {
QTimer::singleShot(1*1000, this, &UDiskDataBackupProxy::checkDestDirExists);
}
}
return true;

View File

@ -58,6 +58,9 @@ private:
// 备份系统
bool backupDataToUdisk();
// 强制结束标志(stop后没反应的情况系统处于睡眠状态)
bool m_isForce;
};
#endif // UDISKDATABACKUPPROXY_H

View File

@ -163,6 +163,7 @@ bool UDiskDataRestoreProxy::checkUdiskExists()
// 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
return false;
}
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) {

View File

@ -19,6 +19,7 @@ UDiskGhostImageProxy::UDiskGhostImageProxy()
m_p = nullptr;
m_bSuccess = false;
m_isFinished = false;
m_isForce = false;
connect(this, &UDiskGhostImageProxy::cancel, this, &UDiskGhostImageProxy::cancelEx);
}
@ -203,6 +204,7 @@ void UDiskGhostImageProxy::doGhostImage()
if (m_bCancel)
return ;
m_isForce = false;
m_isFinished = true;
if (resultRsync) {
// QFileInfo fileInfo(m_kyimg);
@ -252,21 +254,23 @@ void UDiskGhostImageProxy::doGhostImage()
*/
bool UDiskGhostImageProxy::checkDestDirExists()
{
QDir dir(m_backupWrapper.m_prefixDestPath);
if (!dir.exists()) {
qCritical() << QString("dstDir %s is not exist!").arg(m_backupWrapper.m_prefixDestPath);
if (m_mksquashfs)
m_mksquashfs->stop();
if (m_p)
m_p->stop();
return false;
}
if (!m_isFinished)
{
QTimer::singleShot(1*1000, this, &UDiskGhostImageProxy::checkDestDirExists);
// 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
return false;
}
if (Utils::isDirEmpty(m_backupWrapper.m_prefixDestPath) && m_p != nullptr) {
qCritical() << QString("dstDir %s is not exist!").arg(m_backupWrapper.m_prefixDestPath);
m_p->stop();
// 10s钟后如果还没有退出则强制退出
QTimer::singleShot(10*1000, this, &UDiskGhostImageProxy::checkDestDirExists);
m_isForce = true;
} else {
QTimer::singleShot(1*1000, this, &UDiskGhostImageProxy::checkDestDirExists);
}
}
return true;

View File

@ -43,6 +43,8 @@ private:
bool m_bSuccess;
// 是否结束
bool m_isFinished;
// 强制结束标志(stop后没反应的情况系统处于睡眠状态)
bool m_isForce;
};

View File

@ -21,6 +21,7 @@ UDiskSystemBackupProxy::UDiskSystemBackupProxy()
m_calc = new CalcBackupSize(this);
m_isOnlyCheck = true;
m_mksquashfs = nullptr;
m_isForce = false;
connect(this, &UDiskSystemBackupProxy::cancel, this, &UDiskSystemBackupProxy::cancelEx);
}
@ -511,6 +512,7 @@ bool UDiskSystemBackupProxy::backup(const QStringList &args)
if (m_bCancel)
return ;
m_isForce = false;
m_isFinished = true;
if (result) {
m_backupPoint.m_state = BACKUP_PARSE_STATE_SUCCESS_STRTING;
@ -565,23 +567,23 @@ void UDiskSystemBackupProxy::do_kylin_security(const QString& dstDir)
*/
bool UDiskSystemBackupProxy::checkDestDirExists()
{
QDir dir(m_backupWrapper.m_prefixDestPath);
if (!dir.exists()) {
qCritical() << QString("dstDir %s is not exist!").arg(m_backupWrapper.m_prefixDestPath);
if (m_calc)
m_calc->stop();
if (m_mksquashfs)
m_mksquashfs->stop();
if (m_p)
m_p->stop();
return false;
}
if (!m_isFinished)
{
QTimer::singleShot(1*1000, this, &UDiskSystemBackupProxy::checkDestDirExists);
// 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
return false;
}
if (Utils::isDirEmpty(m_backupWrapper.m_prefixDestPath) && m_p != nullptr) {
qCritical() << QString("dstDir %s is not exist!").arg(m_backupWrapper.m_prefixDestPath);
m_p->stop();
// 10s钟后如果还没有退出则强制退出
QTimer::singleShot(10*1000, this, &UDiskSystemBackupProxy::checkDestDirExists);
m_isForce = true;
} else {
QTimer::singleShot(1*1000, this, &UDiskSystemBackupProxy::checkDestDirExists);
}
}
return true;

View File

@ -115,6 +115,8 @@ private:
bool m_isOnlyCheck;
// img文件存放路径
QString m_imgPath;
// 强制结束标志(stop后没反应的情况系统处于睡眠状态)
bool m_isForce;
};
#endif // UDISKSYSTEMBACKUPPROXY_H

View File

@ -463,6 +463,7 @@ bool UDiskSystemRestoreProxy::checkUdiskExists()
// 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
return false;
}
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) {