From 6b36aa089d31573cf9a72da530dc423b3978fda3 Mon Sep 17 00:00:00 2001 From: David Major Date: Wed, 23 May 2018 11:54:21 -0700 Subject: Bug 1458270: Clean up in the shutdown observer. r=milan a=jcristau --HG-- extra : amend_source : 7b1277a18a3ed4f441deef8b51cb4ec4dde614cc --- widget/GfxInfoBase.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'widget/GfxInfoBase.cpp') diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index c937f5099..e20de8277 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -43,6 +43,7 @@ using mozilla::MutexAutoLock; nsTArray* GfxInfoBase::mDriverInfo; bool GfxInfoBase::mDriverInfoObserverInitialized; +bool GfxInfoBase::mShutdownOccurred; // Observes for shutdown so that the child GfxDriverInfo list is freed. class ShutdownObserver : public nsIObserver @@ -62,11 +63,17 @@ public: delete GfxInfoBase::mDriverInfo; GfxInfoBase::mDriverInfo = nullptr; - for (uint32_t i = 0; i < DeviceFamilyMax; i++) + for (uint32_t i = 0; i < DeviceFamilyMax; i++) { delete GfxDriverInfo::mDeviceFamilies[i]; + GfxDriverInfo::mDeviceFamilies[i] = nullptr; + } - for (uint32_t i = 0; i < DeviceVendorMax; i++) + for (uint32_t i = 0; i < DeviceVendorMax; i++) { delete GfxDriverInfo::mDeviceVendors[i]; + GfxDriverInfo::mDeviceVendors[i] = nullptr; + } + + GfxInfoBase::mShutdownOccurred = true; return NS_OK; } @@ -849,6 +856,13 @@ GfxInfoBase::GetFeatureStatusImpl(int32_t aFeature, return NS_OK; } + if (mShutdownOccurred) { + // This is futile; we've already commenced shutdown and our blocklists have + // been deleted. We may want to look into resurrecting the blocklist instead + // but for now, just don't even go there. + return NS_OK; + } + // If an operating system was provided by the derived GetFeatureStatusImpl, // grab it here. Otherwise, the OS is unknown. OperatingSystem os = (aOS ? *aOS : OperatingSystem::Unknown); -- cgit v1.2.3