Short explanation: the destructor of plRegistryKeyList may indirectly
access other entries of fKeyLists where the plRegistryKeyList has
already been deleted, but not yet removed from the map.
Long explanation:
* Deleting a plRegistryKeyList also deletes all plKeys inside it, which
decrements the reference count of the objects they point to.
* If one of the deleted keys happens to be the last reference to an
object, this also deletes the object itself.
* The object's destructor might in turn delete another plKey, which
calls SetKeyUnused, which tries to look up the key in its page.
* If this second plKey belongs to the page that is currently being
unloaded, then its plRegistryKeyList may be partially or completely
deleted, but still listed in the fKeyLists map. In this case, the key
lookup accesses already freed memory.
(ported from H-uru/Plasma@a529e35fd940543752fd74efd0fe63039a03c4a6)
c.f. H'uru commits:
> commit e4e718e243
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Fri Feb 1 17:19:50 2013 -0500
>
> Bypass ATI Generic fudging with Radeon HD cards
> commit bbae6a76d7
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Sat Nov 30 20:02:08 2013 -0500
>
> We don't support 3dfx cards...
>
> Come on, man... They made some good cards, but they went out of business
> in 1999! Ain't nobody got time fo' dat.
> commit a30a326d17
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Sat Nov 30 20:06:19 2013 -0500
>
> We only support DirectX 9...
>
> If you have less than 11MB VRAM or need to use the ref implementation,
> then you are using a dinosaur and have no business even attempting to play
> this game.
> commit 544abef39e
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Sat Nov 30 20:41:56 2013 -0500
>
> Wow, those cards are old...
>
> Remove detection for cards that are don't support at LEAST DirectX 8.
> There's no way they would even be able to get past Direct3DCreate9, so we
> shouldn't need to worry about them... I hope.
> commit 9070d70e50
> Author: Branan Purvine-Riley <branan@gmail.com>
> Date: Sat Jul 27 14:50:20 2013 -0700
>
> Lots of cleanups to hsG3DeviceDelector
> commit ac23835384
> Author: Branan Purvine-Riley <branan@gmail.com>
> Date: Sat Jul 27 15:09:24 2013 -0700
>
> Get rid of obsolete readers/writes for device info
> commit fc67738ee8
> Author: Branan Purvine-Riley <branan@gmail.com>
> Date: Sat Jul 27 15:50:10 2013 -0700
>
> Remove some obviously obsolete caps
> commit 60c544e1ff
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Fri Nov 29 23:42:20 2013 -0500
>
> Don't lazy-load D3D9.dll
>
> We already link against it, so that's just a waste of time. Also, cleanup
> some unneeded ddraw includes. Remember that in Direct3D9, all devices can
> render in windowed mode.
(cherry picked from commit 95ab8161f0)
c.f. H'uru commits:
> commit e4e718e243
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Fri Feb 1 17:19:50 2013 -0500
>
> Bypass ATI Generic fudging with Radeon HD cards
> commit bbae6a76d7
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Sat Nov 30 20:02:08 2013 -0500
>
> We don't support 3dfx cards...
>
> Come on, man... They made some good cards, but they went out of business
> in 1999! Ain't nobody got time fo' dat.
> commit a30a326d17
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Sat Nov 30 20:06:19 2013 -0500
>
> We only support DirectX 9...
>
> If you have less than 11MB VRAM or need to use the ref implementation,
> then you are using a dinosaur and have no business even attempting to play
> this game.
> commit 544abef39e
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Sat Nov 30 20:41:56 2013 -0500
>
> Wow, those cards are old...
>
> Remove detection for cards that are don't support at LEAST DirectX 8.
> There's no way they would even be able to get past Direct3DCreate9, so we
> shouldn't need to worry about them... I hope.
> commit 9070d70e50
> Author: Branan Purvine-Riley <branan@gmail.com>
> Date: Sat Jul 27 14:50:20 2013 -0700
>
> Lots of cleanups to hsG3DeviceDelector
> commit ac23835384
> Author: Branan Purvine-Riley <branan@gmail.com>
> Date: Sat Jul 27 15:09:24 2013 -0700
>
> Get rid of obsolete readers/writes for device info
> commit fc67738ee8
> Author: Branan Purvine-Riley <branan@gmail.com>
> Date: Sat Jul 27 15:50:10 2013 -0700
>
> Remove some obviously obsolete caps
> commit 60c544e1ff
> Author: Adam Johnson <AdamJohnso@gmail.com>
> Date: Fri Nov 29 23:42:20 2013 -0500
>
> Don't lazy-load D3D9.dll
>
> We already link against it, so that's just a waste of time. Also, cleanup
> some unneeded ddraw includes. Remember that in Direct3D9, all devices can
> render in windowed mode.