Skip to content

Commit

Permalink
BatteryWatcher: unsubscribe properly
Browse files Browse the repository at this point in the history
  • Loading branch information
thirtythreeforty committed Jun 19, 2016
1 parent 4ebb7fb commit 74d2a7b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/watcher/BatteryWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ BatteryCallback::BatteryCallback()
BatteryCallback::~BatteryCallback()
{
std::remove(callbacks.begin(), callbacks.end(), this);
if(callbacks.empty()) {
battery_state_service_unsubscribe();
}
}

void BatteryCallback::update_battery_now()
Expand Down

0 comments on commit 74d2a7b

Please sign in to comment.