Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: plugin/win/main_win.cc

Issue 502097: Fixed deadlocks occurring in Chrome during O3D teardown when O3D is in... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: plugin/win/main_win.cc
===================================================================
--- plugin/win/main_win.cc (revision 35127)
+++ plugin/win/main_win.cc (working copy)
@@ -414,7 +414,19 @@
return 1;
}
+static const UINT kDestroyWindowMessageID = WM_USER + 1;
+
LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
+ // To work around deadlocks caused by calling DestroyWindow
+ // synchronously during plugin destruction in Chrome's multi-process
+ // architecture, we call DestroyWindow asynchronously.
+ if (Msg == kDestroyWindowMessageID) {
+ ::DestroyWindow(hWnd);
+ // Do not touch anything related to the plugin; it has likely
+ // already been destroyed.
+ return 0;
+ }
+
PluginObject *obj = PluginObject::GetPluginProperty(hWnd);
if (obj == NULL) { // It's not my window
return 1; // 0 often means we handled it.
@@ -670,7 +682,7 @@
if (obj->GetContentHWnd()) {
::KillTimer(obj->GetContentHWnd(), 0);
PluginObject::ClearPluginProperty(obj->GetContentHWnd());
- ::DestroyWindow(obj->GetContentHWnd());
+ ::PostMessage(obj->GetContentHWnd(), kDestroyWindowMessageID, 0, 0);
obj->SetContentHWnd(NULL);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698