diff options
author | Kissaki <kissaki@gmx.de> | 2015-05-16 12:44:01 +0300 |
---|---|---|
committer | Kissaki <kissaki@gmx.de> | 2015-05-16 12:48:01 +0300 |
commit | 70451a60ce221f2c4a3863b6e275e4ec1444bb5a (patch) | |
tree | 2266c042570e3a8a6a0d755e027e4104717b4cb7 /overlay | |
parent | 57740e7e1b2f9f5a0f3e595bdfa134bab8e5d7a8 (diff) |
Fix #1637 application crashes on Mumble exit
* When unloading the overlay DLL freeD3D9Hook was called *after* unloading the DLL. This is incorrect.
** For applications that actually use D3D and we inject into, the DLL is
never unloaded because we hold a refernce to it ourselves. So in this case,
the problematic code is never executed.
** When not actually injecting, the DLL will be unloaded, and then the
function freeD3D9Hook is called which is from that DLL.
** As we’re executing code in undefined space which previously held the
function, this may or may not crash.
* Remove the freeD3D9Hook function
** The function freeD3D9Hook just resets some fields to NULL and a flag
to false. As the DLL is unloaded anyway, these are never used again.
Hence, we can just remove it altogether (rather than just calling it
before unloading).
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/d3d9.cpp | 19 | ||||
-rw-r--r-- | overlay/lib.cpp | 2 | ||||
-rw-r--r-- | overlay/lib.h | 2 |
3 files changed, 0 insertions, 23 deletions
diff --git a/overlay/d3d9.cpp b/overlay/d3d9.cpp index 82ca25df6..e31608a01 100644 --- a/overlay/d3d9.cpp +++ b/overlay/d3d9.cpp @@ -1010,25 +1010,6 @@ static void hookD3D9(HMODULE hD3D, bool preonly) { } } -void freeD3D9Hook(HMODULE hModule) { - HMODULE hD3D = GetModuleHandle("D3D9.DLL"); - if (bHooked && !hD3D) { - ods("D3D9: Freeing hooks for module %p", hModule); - - hhCreateDevice.reset(); - hhCreateDeviceEx.reset(); - hhReset.reset(); - hhResetEx.reset(); - hhAddRef.reset(); - hhRelease.reset(); - hhPresent.reset(); - hhPresentEx.reset(); - hhSwapPresent.reset(); - - bHooked = false; - } -} - extern "C" __declspec(dllexport) void __cdecl PrepareD3D9() { if (! d3dd) return; diff --git a/overlay/lib.cpp b/overlay/lib.cpp index 9358212c0..9f63771dd 100644 --- a/overlay/lib.cpp +++ b/overlay/lib.cpp @@ -396,8 +396,6 @@ static BOOL WINAPI MyFreeLibrary(HMODULE hModule) { BOOL r = oFreeLibrary(hModule); hhFree.inject(); - freeD3D9Hook(hModule); - return r; } diff --git a/overlay/lib.h b/overlay/lib.h index 8e63be62a..d86fa803b 100644 --- a/overlay/lib.h +++ b/overlay/lib.h @@ -136,8 +136,6 @@ extern void checkDXGI11Hook(bool preonly = false); extern void checkD3D9Hook(bool preonly = false); // From opengl.cpp extern void checkOpenGLHook(); -// From d3d9.cpp -extern void freeD3D9Hook(HMODULE hModule); // From d3d9.cpp extern Direct3D9Data *d3dd; |