Index: ppapi/proxy/plugin_globals.cc |
diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc |
index 1106a75b5616febf09446d485fed84faf442cc18..2913aa23eb0330685e011332f8f128dcab25656d 100644 |
--- a/ppapi/proxy/plugin_globals.cc |
+++ b/ppapi/proxy/plugin_globals.cc |
@@ -76,6 +76,13 @@ PluginGlobals::PluginGlobals(ForTest for_test) |
PluginGlobals::~PluginGlobals() { |
DCHECK(plugin_globals_ == this || !plugin_globals_); |
+ // Release the main-thread message loop. We should have the last reference |
+ // count, so this will delete the MessageLoop resource. We do this before |
+ // we clear plugin_globals_, because the Resource destructor tries to access |
+ // this PluginGlobals. |
+ DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef()); |
+ loop_for_main_thread_ = NULL; |
+ |
plugin_globals_ = NULL; |
} |