🐞 fix(UI模块): 解决空指针异常问题

This commit is contained in:
huheng@kylinos.cn 2022-10-13 15:26:31 +08:00
parent c7f63f2b21
commit 5039f3370a
1 changed files with 10 additions and 5 deletions

View File

@ -172,6 +172,11 @@ void MainWindow::initService()
KYLIN_CONNECTIVITY_MANAGER_INTERFACE, QDBusConnection::systemBus());
QObject::connect(m_dbusInterface, SIGNAL(sigMountError(bool, QString)), this, SLOT(slotMountError(bool, QString)));
QObject::connect(m_dbusInterface, SIGNAL(sigInitDiscServer(bool)), this, SLOT(slotInitDiscServerResult(bool)));
m_discovery = new KMobileDiscovery::Discovery();
connect(m_discovery, &KMobileDiscovery::Discovery::sigAllDeviceInfo, this, &MainWindow::slotAllDeviceInfo);
discInit();
}
@ -281,6 +286,8 @@ void MainWindow::deleterService()
if (m_dbusInterface->isValid()) {
m_dbusInterface->call("killServerPortProcess");
}
delete m_dbusInterface;
m_dbusInterface = nullptr;
}
}
@ -418,7 +425,7 @@ void MainWindow::connectUI()
stopLoadUI();
// m_discovery->stopDiscovery();
m_discovery->stopDiscovery();
QString str1 = "";
if (m_connectInfo.deviceRole == ConnectionService::DeviceRole::INITIATOR) {
@ -827,7 +834,7 @@ void MainWindow::slotFtpConnected()
m_isMountFtp = true;
Q_EMIT sigConnected(m_connectInfo.deviceName);
if (m_connectInfo.deviceType == ConnectionService::DeviceType::PC) {
// initPcSearchInfo();
initPcSearchInfo();
updateResult();
slotCdMobileStorageDirectory("/");
} else if (m_connectInfo.deviceType == ConnectionService::DeviceType::ANDROID) {
@ -928,7 +935,7 @@ void MainWindow::slotDownTempFileFinish(QString filePath)
stopLoadUI();
if (m_isPcSearchInfo) {
m_isPcSearchInfo = false;
m_titlebar->onSearchInstalled(true, filePath);
// m_titlebar->onSearchInstalled(true, filePath);
} else if (!filePath.isEmpty()) {
FileInfo::fileOpen(filePath);
} else {
@ -1569,8 +1576,6 @@ void MainWindow::slotInitDiscServerResult(bool flag)
connect(m_discClient, &QProcess::started, this, [=]() {
qInfo() << "softbus init success";
GenerateTools::delayMs(500);
m_discovery = new KMobileDiscovery::Discovery();
connect(m_discovery, &KMobileDiscovery::Discovery::sigAllDeviceInfo, this, &MainWindow::slotAllDeviceInfo);
m_discovery->startDiscovery();
});
connect(m_discClient, &QProcess::readyReadStandardError, this, [=]() {