fix(dir-manager):mount和umount收不到信号导致处理重复挂载异常

原因是内核对于mount和umount不会发udisk信号,目前暂时改每次查询手动刷新
This commit is contained in:
JunjieBai 2024-04-24 17:48:36 +08:00 committed by iaom
parent faab11ca30
commit fe0950c576
2 changed files with 5 additions and 1 deletions

View File

@ -86,6 +86,8 @@ void SearchDir::generateBlackList()
QStringList SearchDir::blackListOfDir(const QString &dirPath)
{
//手动刷新挂载信息
VolumeManager::self()->refresh();
QStringList blackListOfDir;
for (const QStringList & mountPoints: VolumeManager::self()->getDuplicates()) {
QString topRepeatedMountPoint;
@ -113,6 +115,8 @@ QStringList SearchDir::blackListOfDir(const QString &dirPath)
void SearchDir::handleBlackListGenerate()
{
//手动刷新挂载信息
VolumeManager::self()->refresh();
QStringList searchDirs = Config::self()->searchDirs();
//目录已被索引(根目录被添加过直接返回)

View File

@ -58,12 +58,12 @@ public:
QVector<QStringList> getDuplicates();
QVector<Volume> volumesHaveSubVolumes();
QVector<Volume> volumes();
void refresh();
Q_SIGNALS:
void VolumeDataUpdated();
private:
explicit VolumeManager(QObject *parent = nullptr);
void refresh();
static void mountAddCallback(GVolumeMonitor *monitor, GMount *gmount, VolumeManager *pThis);
static void mountRemoveCallback(GVolumeMonitor *monitor, GMount *gmount, VolumeManager *pThis);
GVolumeMonitor* m_volumeMonitor = nullptr;