From baf40c3cf7ceae864112c56a14af2f4381b0f09f Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 13 Jan 2023 15:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/dirwatcher/dir-watcher.cpp | 4 +--- libsearch/dirwatcher/dir-watcher.h | 3 --- .../ukui-search-dir-manager-dbus.cpp | 4 +--- .../ukui-search-dir-manager-dbus.h | 3 --- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/libsearch/dirwatcher/dir-watcher.cpp b/libsearch/dirwatcher/dir-watcher.cpp index 55bcb87..af6fe43 100644 --- a/libsearch/dirwatcher/dir-watcher.cpp +++ b/libsearch/dirwatcher/dir-watcher.cpp @@ -8,14 +8,12 @@ static std::once_flag flag; static DirWatcher *global_intance = nullptr; DirWatcher::DirWatcher(QObject *parent) - : QObject(parent), m_semaphore(QStringLiteral("ukui-search-dir-manager-dbus-register-sem"), 0, QSystemSemaphore::AccessMode::Open) + : QObject(parent) { m_dbusInterface = new QDBusInterface("com.ukui.search.fileindex.service", "/org/ukui/search/privateDirWatcher", "org.ukui.search.fileindex"); - m_semaphore.acquire(); - m_semaphore.release(); if (!m_dbusInterface->isValid()) { qCritical() << "Create privateDirWatcher Interface Failed Because: " << QDBusConnection::sessionBus().lastError(); return; diff --git a/libsearch/dirwatcher/dir-watcher.h b/libsearch/dirwatcher/dir-watcher.h index 041acb3..9536c33 100644 --- a/libsearch/dirwatcher/dir-watcher.h +++ b/libsearch/dirwatcher/dir-watcher.h @@ -4,7 +4,6 @@ #include #include #include -#include class DirWatcher : public QObject { @@ -34,8 +33,6 @@ private: ~DirWatcher(); QDBusInterface *m_dbusInterface = nullptr; - - QSystemSemaphore m_semaphore; }; #endif // MOUNTDISKLISTENER_H diff --git a/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.cpp b/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.cpp index 344f4c0..6b6625b 100644 --- a/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.cpp +++ b/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.cpp @@ -6,7 +6,7 @@ #include UkuiSearchDirManagerDbus::UkuiSearchDirManagerDbus(int &argc, char *argv[], const QString &applicationName) - : QtSingleApplication (applicationName, argc, argv), m_semaphore(QStringLiteral("ukui-search-dir-manager-dbus-register-sem"), 0, QSystemSemaphore::AccessMode::Create) + : QtSingleApplication (applicationName, argc, argv) { setQuitOnLastWindowClosed(false); setApplicationVersion(QString("v%1").arg(VERSION)); @@ -17,7 +17,6 @@ UkuiSearchDirManagerDbus::UkuiSearchDirManagerDbus(int &argc, char *argv[], cons if(!sessionBus.registerService("com.ukui.search.fileindex.service")) { qCritical() << "QDbus register service failed reason:" << sessionBus.lastError(); } - if(!sessionBus.registerObject("/org/ukui/search/privateDirWatcher", DirWatcher::getDirWatcher(), QDBusConnection::ExportNonScriptableSlots | QDBusConnection::ExportAllSignals)) { qCritical() << "ukui-search-fileindex dbus register object failed reason:" << sessionBus.lastError(); } @@ -28,7 +27,6 @@ UkuiSearchDirManagerDbus::UkuiSearchDirManagerDbus(int &argc, char *argv[], cons } else { qWarning() << "Ukui search dir manager is running!"; } - m_semaphore.release(); //parse cmd qDebug()<<"parse cmd"; auto message = this->arguments().join(' ').toUtf8(); diff --git a/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.h b/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.h index ddffe13..d8f7f96 100644 --- a/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.h +++ b/ukui-search-service-dir-manager/ukui-search-dir-manager-dbus.h @@ -1,7 +1,6 @@ #ifndef UKUISEARCHDIRWATCHERDBUS_H #define UKUISEARCHDIRWATCHERDBUS_H -#include #include "qtsingleapplication.h" class UkuiSearchDirManagerDbus : public QtSingleApplication @@ -11,8 +10,6 @@ public: UkuiSearchDirManagerDbus(int &argc, char *argv[], const QString &applicationName = "ukui-search-service-dir-manager"); protected Q_SLOTS: void parseCmd(QString msg, bool isPrimary); -private: - QSystemSemaphore m_semaphore; }; #endif // UKUISEARCHDIRWATCHERDBUS_H