If StatusNotifierItem is registered and then immediately destroyed, it is possible that QDBusServiceWatcher will not emit the serviceUnregistered signal.
Add an additional check to avoid such situations.
BUG: 416652
FIXED-IN: 5.18.0
If StatusNotifierItem is registered and then immediately destroyed, it is possible that QDBusServiceWatcher will not emit the serviceUnregistered signal.
Add an additional check to avoid such situations.
BUG: 416652
FIXED-IN: 5.18.0
Telegram should not add empty items.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
It is hard to reproduce, but with enough tries you should get empty items in "hidden" area of system tray. I used this script:
for i in `seq 1 100`; do echo $i telegram-desktop & sleep 2 killall telegram-desktop done
Well identified, it is racey.
But the solution seems off
on line 68 we check
on line 75 we implicitly check again
now we're checking a 3rd time!
I think we can instead solve it with some re-arranging
m_serviceWatcher->addWatchedService(service); if (QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value()) { // as before except for the moved line } else { m_serviceWatcher->removeWatchedService(service); }
Updated the code. This time I was not event able to reproduce race condition. Is something like this OK?
statusnotifierwatcher/statusnotifierwatcher.cpp | ||
---|---|---|
69 | Is this OK? Are mid-method returns allowed? |
statusnotifierwatcher/statusnotifierwatcher.cpp | ||
---|---|---|
69 | They are |