fix crash issue while deleting adapters
crash was observed while deleting gnss, flp and geofence adapters. solution is not to delete the Adapter in the deinitialize function Change-Id: Ia260dd6f2c532111b82b621a3640d6ef834bb671 CRs-Fixed: 2030458
This commit is contained in:
parent
d48c19e8f0
commit
2b7f0b434d
1 changed files with 0 additions and 33 deletions
|
@ -201,37 +201,14 @@ LocationAPI::~LocationAPI()
|
||||||
|
|
||||||
auto it = gData.clientData.find(this);
|
auto it = gData.clientData.find(this);
|
||||||
if (it != gData.clientData.end()) {
|
if (it != gData.clientData.end()) {
|
||||||
size_t gnssClientCount = 0;
|
|
||||||
size_t flpClientCount = 0;
|
|
||||||
size_t geofenceClientCount = 0;
|
|
||||||
for (auto it2=gData.clientData.begin(); it2 != gData.clientData.end(); ++it2) {
|
|
||||||
if (isGnssClient(it2->second)) {
|
|
||||||
gnssClientCount++;
|
|
||||||
}
|
|
||||||
if (isFlpClient(it2->second)) {
|
|
||||||
flpClientCount++;
|
|
||||||
}
|
|
||||||
if (isGeofenceClient(it2->second)) {
|
|
||||||
geofenceClientCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isGnssClient(it->second) && NULL != gData.gnssInterface) {
|
if (isGnssClient(it->second) && NULL != gData.gnssInterface) {
|
||||||
gData.gnssInterface->removeClient(it->first);
|
gData.gnssInterface->removeClient(it->first);
|
||||||
if (1 == gnssClientCount && NULL == gData.controlAPI) {
|
|
||||||
gData.gnssInterface->deinitialize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isFlpClient(it->second) && NULL != gData.flpInterface) {
|
if (isFlpClient(it->second) && NULL != gData.flpInterface) {
|
||||||
gData.flpInterface->removeClient(it->first);
|
gData.flpInterface->removeClient(it->first);
|
||||||
if (1 == flpClientCount) {
|
|
||||||
gData.flpInterface->deinitialize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isGeofenceClient(it->second) && NULL != gData.geofenceInterface) {
|
if (isGeofenceClient(it->second) && NULL != gData.geofenceInterface) {
|
||||||
gData.geofenceInterface->removeClient(it->first);
|
gData.geofenceInterface->removeClient(it->first);
|
||||||
if (1 == geofenceClientCount) {
|
|
||||||
gData.geofenceInterface->deinitialize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
gData.clientData.erase(it);
|
gData.clientData.erase(it);
|
||||||
} else {
|
} else {
|
||||||
|
@ -593,16 +570,6 @@ LocationControlAPI::~LocationControlAPI()
|
||||||
LOC_LOGD("LOCATION CONTROL API DESTRUCTOR");
|
LOC_LOGD("LOCATION CONTROL API DESTRUCTOR");
|
||||||
pthread_mutex_lock(&gDataMutex);
|
pthread_mutex_lock(&gDataMutex);
|
||||||
|
|
||||||
size_t gnssClientCount = 0;
|
|
||||||
for (auto it=gData.clientData.begin(); it != gData.clientData.end(); ++it) {
|
|
||||||
if (isGnssClient(it->second)) {
|
|
||||||
gnssClientCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (gData.gnssInterface != NULL && 0 == gnssClientCount) {
|
|
||||||
//@todo: we might want to call gData.gnssInterface.disable before deinitialize?
|
|
||||||
gData.gnssInterface->deinitialize();
|
|
||||||
}
|
|
||||||
gData.controlAPI = NULL;
|
gData.controlAPI = NULL;
|
||||||
|
|
||||||
pthread_mutex_unlock(&gDataMutex);
|
pthread_mutex_unlock(&gDataMutex);
|
||||||
|
|
Loading…
Reference in a new issue