зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1173802: Store global NFC service in ref-counted variable, r=allstars.chh
|ClearOnShutdown| deletes pointers by assigning |nullptr|. This patch converts |gNfcService| to a smart pointer, so that cleaning its value during shutdown will actually destruct the instance.
This commit is contained in:
Родитель
d79778ce4e
Коммит
eb8fc500c5
|
@ -34,7 +34,7 @@ using namespace mozilla::ipc;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
static NfcService* gNfcService;
|
||||
static StaticRefPtr<NfcService> gNfcService;
|
||||
|
||||
NS_IMPL_ISUPPORTS(NfcService, nsINfcService)
|
||||
|
||||
|
@ -456,7 +456,7 @@ NfcService::FactoryCreate()
|
|||
ClearOnShutdown(&gNfcService);
|
||||
}
|
||||
|
||||
nsRefPtr<NfcService> service = gNfcService;
|
||||
nsRefPtr<NfcService> service(gNfcService);
|
||||
return service.forget();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче