summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 02:27:35 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 02:27:35 +0000
commitbd04c9889d9607a69cf696fc5136dab6d6c83dec (patch)
tree1617936cf03012d5532f04bae986f1dda0329c30 /o3d/plugin
parent0538776d92b03c09d1768ccc4a9397228389c1f4 (diff)
downloadchromium_src-bd04c9889d9607a69cf696fc5136dab6d6c83dec.zip
chromium_src-bd04c9889d9607a69cf696fc5136dab6d6c83dec.tar.gz
chromium_src-bd04c9889d9607a69cf696fc5136dab6d6c83dec.tar.bz2
Fixed deadlocks occurring in Chrome during O3D teardown when O3D is in
full-screen mode and another plugin on the page is making an NPAPI call. Deferred O3D's window destruction to work around this issue. Tested O3D and related tests in all browsers; this fixes the deadlock and seems to not introduce any other instability. Review URL: http://codereview.chromium.org/502097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin')
-rw-r--r--o3d/plugin/win/main_win.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/o3d/plugin/win/main_win.cc b/o3d/plugin/win/main_win.cc
index 6e8743f..7641611 100644
--- a/o3d/plugin/win/main_win.cc
+++ b/o3d/plugin/win/main_win.cc
@@ -414,7 +414,19 @@ LRESULT HandleDragAndDrop(PluginObject *obj, WPARAM wParam) {
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 @@ void CleanupAllWindows(PluginObject *obj) {
if (obj->GetContentHWnd()) {
::KillTimer(obj->GetContentHWnd(), 0);
PluginObject::ClearPluginProperty(obj->GetContentHWnd());
- ::DestroyWindow(obj->GetContentHWnd());
+ ::PostMessage(obj->GetContentHWnd(), kDestroyWindowMessageID, 0, 0);
obj->SetContentHWnd(NULL);
}