fix(dir-manager):mount和umount收不到信号导致处理重复挂载异常
原因是内核对于mount和umount不会发udisk信号,目前暂时改每次查询手动刷新
This commit is contained in:
parent
9293486485
commit
f4e5090beb
|
@ -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();
|
||||
|
||||
//目录已被索引(根目录被添加过直接返回)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue