Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro

This commit is contained in:
Nicolas Silva 2015-09-15 17:58:06 +02:00
parent 82916146d1
commit 01b1e6af97
2 changed files with 9 additions and 0 deletions

View File

@ -6542,6 +6542,11 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
LayerManagerPersistence aPersistence, LayerManagerPersistence aPersistence,
bool* aAllowRetaining) bool* aAllowRetaining)
{ {
if (mIsDestroyed) {
// Prevent external code from triggering the re-creation of the LayerManager/Compositor
// during shutdown. Just return what we currently have, which is most likely null.
return mLayerManager;
}
if (!mLayerManager && eTransparencyTransparent == GetTransparencyMode()) { if (!mLayerManager && eTransparencyTransparent == GetTransparencyMode()) {
mLayerManager = CreateBasicLayerManager(); mLayerManager = CreateBasicLayerManager();
} }

View File

@ -1146,6 +1146,10 @@ LayerManager* nsBaseWidget::GetLayerManager(PLayerTransactionChild* aShadowManag
bool* aAllowRetaining) bool* aAllowRetaining)
{ {
if (!mLayerManager) { if (!mLayerManager) {
if (!mShutdownObserver) {
// We are shutting down, do not try to re-create a LayerManager
return nullptr;
}
// Try to use an async compositor first, if possible // Try to use an async compositor first, if possible
if (ShouldUseOffMainThreadCompositing()) { if (ShouldUseOffMainThreadCompositing()) {
// e10s uses the parameter to pass in the shadow manager from the TabChild // e10s uses the parameter to pass in the shadow manager from the TabChild