1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Increment clipper ref count while attached to a surface

Fixes a crash in Midtown Madness startup.

Clipper attached to primary surface was destroyed before
Surface destructor was executed.
This commit is contained in:
narzoul 2021-07-06 23:32:00 +02:00
parent 00a78097d2
commit 2b691ebdc7

View File

@ -166,6 +166,7 @@ namespace DDraw
} }
g_clipperData.erase(it->second); g_clipperData.erase(it->second);
} }
getOrigVtable(prevClipper).Release(prevClipper);
g_surfaceToClipperData.erase(it); g_surfaceToClipperData.erase(it);
} }
@ -183,6 +184,7 @@ namespace DDraw
} }
++clipperDataIter->second.refCount; ++clipperDataIter->second.refCount;
g_surfaceToClipperData[&surface] = clipperDataIter; g_surfaceToClipperData[&surface] = clipperDataIter;
getOrigVtable(clipper).AddRef(clipper);
} }
} }