diff options
| author | Kevin Tang <zhikait@codeaurora.org> | 2016-12-13 16:53:30 -0800 |
|---|---|---|
| committer | c457 <android.c357@gmail.com> | 2017-01-31 13:41:00 -0600 |
| commit | 94c73ecec3a03a96f539b20a5a028e74adc9e146 (patch) | |
| tree | b9a4139a7255c51a7ccc79f0dea11f20da1ca498 | |
| parent | b293aea4dcfa493da1784062caaa3187e5f23bc2 (diff) | |
gps: fixing a potential race condition
mUlp might be obsolete already by the time the
LocEngSuplMode::proc() method gets to run. It
would be safe to get the pointer of adapter,
then acquire the ulp obj from that then it is
time to use it.
Change-Id: I67312903b0f28ae494b7b27017680f9bcfd135c3
CRs-Fixed: 1101095
| -rw-r--r-- | gps/loc_api/libloc_api_50001/loc_eng.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gps/loc_api/libloc_api_50001/loc_eng.cpp b/gps/loc_api/libloc_api_50001/loc_eng.cpp index 318786d..51c0bff 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng.cpp +++ b/gps/loc_api/libloc_api_50001/loc_eng.cpp @@ -523,15 +523,15 @@ struct LocEngSuplVer : public LocMsg { }; struct LocEngSuplMode : public LocMsg { - UlpProxyBase* mUlp; + LocEngAdapter* mAdapter; - inline LocEngSuplMode(UlpProxyBase* ulp) : - LocMsg(), mUlp(ulp) + inline LocEngSuplMode(LocEngAdapter* adapter) : + LocMsg(), mAdapter(adapter) { locallog(); } inline virtual void proc() const { - mUlp->setCapabilities(ContextBase::getCarrierCapabilities()); + mAdapter->getUlpProxy()->setCapabilities(ContextBase::getCarrierCapabilities()); } inline void locallog() const { } @@ -2783,7 +2783,7 @@ void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); } if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) { - adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy())); + adapter->sendMsg(new LocEngSuplMode(adapter)); } // we always update lock mask, this is because if this is dsds device, we would not // know if modem has switched dds, if so, lock mask may also need to be updated. |
