summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/plugin/win/main_win.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/o3d/plugin/win/main_win.cc b/o3d/plugin/win/main_win.cc
index 85bc28c..0fd3148 100644
--- a/o3d/plugin/win/main_win.cc
+++ b/o3d/plugin/win/main_win.cc
@@ -657,6 +657,16 @@ void CleanupAllWindows(PluginObject *obj) {
DCHECK(obj->GetContentHWnd());
DCHECK(obj->GetPluginHWnd());
::KillTimer(obj->GetContentHWnd(), 0);
+
+ // Restore the original WNDPROC on the plugin window so that we
+ // don't attempt to call into the O3D DLL after it's been unloaded.
+ LONG_PTR origWndProc = reinterpret_cast<LONG_PTR>(
+ GetProp(obj->GetPluginHWnd(),
+ kOrigWndProcName));
+ DCHECK(origWndProc != NULL);
+ RemoveProp(obj->GetPluginHWnd(), kOrigWndProcName);
+ SetWindowLongPtr(obj->GetPluginHWnd(), GWLP_WNDPROC, origWndProc);
+
PluginObject::ClearPluginProperty(obj->GetContentHWnd());
PluginObject::ClearPluginProperty(obj->GetPluginHWnd());
::DestroyWindow(obj->GetContentHWnd());