fix(frontend):修复了一个远程桌面连接时偶现的崩溃问题
该问题曾导致远程连接建立后,本地进程退出后,远程的进程dbus接口被调用时偶现崩溃
This commit is contained in:
parent
fad3f9cd2e
commit
edd051de40
|
@ -73,21 +73,9 @@ UkuiSearchDbusServices::UkuiSearchDbusServices(MainWindow *m, QObject *parent):
|
|||
}
|
||||
}
|
||||
|
||||
UkuiSearchDbusServices::~UkuiSearchDbusServices()
|
||||
{
|
||||
if(m_watcher) {
|
||||
delete m_watcher;
|
||||
m_watcher = nullptr;
|
||||
}
|
||||
if(m_serviceIface) {
|
||||
delete m_serviceIface;
|
||||
m_serviceIface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UkuiSearchDbusServices::initWatcher()
|
||||
{
|
||||
m_watcher = new QDBusServiceWatcher(QStringLiteral("com.ukui.search.service"),QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange);
|
||||
m_watcher = new QDBusServiceWatcher(QStringLiteral("com.ukui.search.service"),QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
|
||||
connect(m_watcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &UkuiSearchDbusServices::onServiceOwnerChanged);
|
||||
connectToService();
|
||||
}
|
||||
|
@ -131,9 +119,7 @@ UkuiSearchDbusServices::onServiceOwnerChanged(const QString &service, const QStr
|
|||
|
||||
void UkuiSearchDbusServices::connectToService()
|
||||
{
|
||||
if(!m_serviceIface) {
|
||||
m_serviceIface = new OrgUkuiSearchServiceInterface(QStringLiteral("com.ukui.search.service"), "/", QDBusConnection::sessionBus());
|
||||
}
|
||||
m_serviceIface = new OrgUkuiSearchServiceInterface(QStringLiteral("com.ukui.search.service"), "/", QDBusConnection::sessionBus(), this);
|
||||
connect(m_serviceIface, &OrgUkuiSearchServiceInterface::showWindowSignal, this, &UkuiSearchDbusServices::onShowWindow);
|
||||
connect(m_serviceIface, &OrgUkuiSearchServiceInterface::searchKeywordSignal, this, &UkuiSearchDbusServices::onSearchKeyword);
|
||||
connect(m_serviceIface, &OrgUkuiSearchServiceInterface::mainWindowSwitchSignal, this, &UkuiSearchDbusServices::onMainWindowSwitch);
|
||||
|
@ -143,8 +129,7 @@ void UkuiSearchDbusServices::disConnectToService()
|
|||
{
|
||||
if(m_serviceIface) {
|
||||
m_serviceIface->disconnect();
|
||||
delete m_serviceIface;
|
||||
m_serviceIface = nullptr;
|
||||
m_serviceIface->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ class UkuiSearchDbusServices: public QObject, public QDBusContext
|
|||
|
||||
public:
|
||||
explicit UkuiSearchDbusServices(MainWindow *m, QObject *parent = nullptr);
|
||||
~UkuiSearchDbusServices();
|
||||
|
||||
public Q_SLOTS:
|
||||
void showWindow();
|
||||
|
|
Loading…
Reference in New Issue