Index: ui/compositor/layer.cc |
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
index 9bb17daf8e48bf937adbb2d3b63823184a183a21..c96ac53612f229a1994e0cadef309be998b24e21 100644 |
--- a/ui/compositor/layer.cc |
+++ b/ui/compositor/layer.cc |
@@ -487,6 +487,10 @@ void Layer::SwitchCCLayerForTest() { |
} |
void Layer::SetExternalTexture(Texture* texture) { |
+ // Hold a ref to the old |Texture| until we have updated all |
+ // compositor references to the texture id that it holds. |
+ scoped_refptr<ui::Texture> old_texture = texture_; |
+ |
DCHECK_EQ(type_, LAYER_TEXTURED); |
DCHECK(!solid_color_layer_); |
bool has_texture = !!texture; |