diff --git a/solid/solid/backends/upower/upowerbattery.cpp b/solid/solid/backends/upower/upowerbattery.cpp
index 7b5bdc4..8bd9343 100644
--- a/solid/solid/backends/upower/upowerbattery.cpp
+++ b/solid/solid/backends/upower/upowerbattery.cpp
@@ -123,6 +123,7 @@ Solid::Battery::ChargeState Battery::chargeState() const
void Battery::slotChanged()
{
if (m_device) {
+ const QString udi = m_device.data()->udi();
const int old_chargePercent = m_chargePercent;
const int old_capacity = m_capacity;
const Solid::Battery::ChargeState old_chargeState = m_chargeState;
@@ -132,26 +133,26 @@ void Battery::slotChanged()
if (old_chargePercent != m_chargePercent)
{
- emit chargePercentChanged(m_chargePercent, m_device.data()->udi());
+ emit chargePercentChanged(m_chargePercent, udi);
}
if (old_capacity != m_capacity) {
- emit capacityChanged(m_capacity, m_device.data()->udi());
+ emit capacityChanged(m_capacity, udi);
}
if (old_chargeState != m_chargeState)
{
- emit chargeStateChanged(m_chargeState, m_device.data()->udi());
+ emit chargeStateChanged(m_chargeState, udi);
}
if (old_isPlugged != m_isPlugged)
{
- emit plugStateChanged(m_isPlugged, m_device.data()->udi());
+ emit plugStateChanged(m_isPlugged, udi);
}
if (old_isPowerSupply != m_isPowerSupply)
{
- emit powerSupplyStateChanged(m_isPowerSupply, m_device.data()->udi());
+ emit powerSupplyStateChanged(m_isPowerSupply, udi);
}
}
}