Changeset View
Changeset View
Standalone View
Standalone View
src/qml/experimental/monitor.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 58 | connect(m_scheduler, &org::kde::baloo::scheduler::stateChanged, | |||
---|---|---|---|---|---|
59 | this, &Monitor::slotIndexerStateChanged); | 59 | this, &Monitor::slotIndexerStateChanged); | ||
60 | 60 | | |||
61 | if (m_scheduler->isValid()) { | 61 | if (m_scheduler->isValid()) { | ||
62 | // baloo is already running | 62 | // baloo is already running | ||
63 | balooStarted(m_scheduler->service()); | 63 | balooStarted(m_scheduler->service()); | ||
64 | 64 | | |||
65 | } else { | 65 | } else { | ||
66 | m_balooRunning = false; | 66 | m_balooRunning = false; | ||
67 | QDBusServiceWatcher* balooWatcher = new QDBusServiceWatcher(m_scheduler->service(), | 67 | QDBusServiceWatcher* balooWatcher = new QDBusServiceWatcher(m_scheduler->service(), | ||
bruns: The watcher should be installed unconditionally, and first.
Checking state first and the… | |||||
davidedmundson: Good catch. Done | |||||
68 | m_bus, | 68 | m_bus, | ||
69 | QDBusServiceWatcher::WatchForRegistration, | 69 | QDBusServiceWatcher::WatchForRegistration, | ||
70 | this); | 70 | this); | ||
71 | connect(balooWatcher, &QDBusServiceWatcher::serviceRegistered, this, &Monitor::balooStarted); | 71 | connect(balooWatcher, &QDBusServiceWatcher::serviceRegistered, this, &Monitor::balooStarted); | ||
72 | connect(balooWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() { | ||||
73 | m_balooRunning = false; | ||||
74 | m_indexerState = Baloo::Unavailable; | ||||
75 | emit balooStateChanged(); | ||||
76 | emit indexerStateChanged(); | ||||
77 | }); | ||||
78 | | ||||
72 | } | 79 | } | ||
73 | } | 80 | } | ||
74 | 81 | | |||
75 | void Monitor::newFile(const QString& filePath) | 82 | void Monitor::newFile(const QString& filePath) | ||
76 | { | 83 | { | ||
77 | if (m_totalFiles == 0) { | 84 | if (m_totalFiles == 0) { | ||
78 | fetchTotalFiles(); | 85 | fetchTotalFiles(); | ||
79 | } | 86 | } | ||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |
The watcher should be installed unconditionally, and first.
Checking state first and the instaling the watcher is racy.