[Bug] startAsync can cause call method on partially destroyed object
[Cause] async call are processed while ZoneManager is being destroyed
[Solution] Ensure that all async calls was ended
[Verification] Set EVENT_TIMEOUT=5 (ut-zones-manager.cpp), build, install,
run ZonesManagerSuite/StartShutdownZoneTest with 1000
times less speed.
Change-Id: I00bc8c0926be8a9a62ec23b81f62a2827db4799b
// Make sure all OnNameLostCallbacks get finished and no new will
// get called before proceeding further. This guarantees no race
// condition on the reconnect thread.
- Lock lock(mReconnectMutex);
- disconnect();
+ {
+ Lock lock(mReconnectMutex);
+ disconnect();
+ }
+ // wait for all tasks to complete
+ mWorker.reset();
}
const std::vector<boost::regex>& Zone::getPermittedToSend() const
LOGE("Failed to stop all of the zones");
}
}
+ // wait for all tasks to complete
+ mWorker.reset();
LOGD("ZonesManager object destroyed");
}