Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2013-10-23 20:44:37 +0400
committerStefan Hacker <dd0t@users.sourceforge.net>2013-10-23 20:44:37 +0400
commit07e055fff12b0e2f890eec47ee9e4ae19e53fa6a (patch)
tree25f04962ac3efeed26f2ff6095fa335352297257 /overlay
parenta6f76100821a506d4814cb1c7edfa8fab3bcf164 (diff)
Fix overlay regression that in some cases prevented injection into devices in myCreateDevice(/Ex)
Incorrect checking for element existence in the std::map using the operator[] caused interfaces to be added to the device map that weren't actually injected to yet. To minimize code impact before DX11 branch merge replace correct existence checks triggering the bug with checks on whether there's a valid handle (!= NULL) present for that device in the map. This way the default constructed (and hence NULL) elements caused by the use of the operator[] are harmless. For the future we'll have to decide whether we accept additional elements for "simpler" coding or use the "logically cleaner" style of using find and iterators.
Diffstat (limited to 'overlay')
-rw-r--r--overlay/d3d9.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/overlay/d3d9.cpp b/overlay/d3d9.cpp
index 883b61d22..29a7cf832 100644
--- a/overlay/d3d9.cpp
+++ b/overlay/d3d9.cpp
@@ -700,7 +700,7 @@ static HRESULT __stdcall myCreateDevice(IDirect3D9 * id3d, UINT Adapter, D3DDEVT
idd->AddRef();
ds->initRefCount = idd->Release();
- if (devMap.find(idd) != devMap.end()) {
+ if (devMap[idd] != NULL) {
ods("Device exists in devMap already - canceling injection into device");
delete ds;
return hr;
@@ -764,7 +764,7 @@ static HRESULT __stdcall myCreateDeviceEx(IDirect3D9Ex * id3d, UINT Adapter, D3D
idd->AddRef();
ds->initRefCount = idd->Release();
- if (devMap.find(idd) != devMap.end()) {
+ if (devMap[idd] != NULL) {
ods("Device exists in devMap already - canceling injection into device");
delete ds;
return hr;