Index: content/renderer/pepper/pepper_graphics_2d_host.cc |
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc |
index 2c04d761460bc8a77ddadbe02c7270b60a4f8ff0..41f9c72039c6a7c582368cce08eaf6358af2ef63 100644 |
--- a/content/renderer/pepper/pepper_graphics_2d_host.cc |
+++ b/content/renderer/pepper/pepper_graphics_2d_host.cc |
@@ -42,11 +42,11 @@ PepperGraphics2DHost::PepperGraphics2DHost(RendererPpapiHost* host, |
} |
PepperGraphics2DHost::~PepperGraphics2DHost() { |
- // Unbind from the instance when destoryed. |
- PP_Instance instance = graphics_2d_->pp_instance(); |
- ppapi::thunk::EnterInstanceNoLock enter(instance); |
- if (enter.succeeded()) |
- enter.functions()->BindGraphics(instance, 0); |
+ // Unbind from the instance when destroyed if we're still bound. |
+ webkit::ppapi::PluginInstance* bound_instance = |
+ graphics_2d_->bound_instance(); |
+ if (bound_instance) |
+ bound_instance->BindGraphics(bound_instance->pp_instance(), 0); |
} |
int32_t PepperGraphics2DHost::OnResourceMessageReceived( |