summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows/drawd3d.c
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2011-11-18 06:23:04 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2011-11-18 06:23:04 +0000
commit9063cb221f198082771e5a87d33856625c71f666 (patch)
tree06cd34d4ffd24f7880647107b5a5f840ec83f382 /src/osd/windows/drawd3d.c
parentcb03f6722d00155481b14da3d2f66efff2fdb1ef (diff)
- Fixed HLSL memory leak and crash on exit on 32-bit targets. [Ryan Holtz, Bat Country Entertainment]
Word around the campfire is this totally works and stuff. More technically, it eliminates a number of double-frees and also now cleans up the shadow mask PNG and hlsl_options allocations. (nw)
Diffstat (limited to 'src/osd/windows/drawd3d.c')
-rw-r--r--src/osd/windows/drawd3d.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c
index fd494f8560c..6f193be9974 100644
--- a/src/osd/windows/drawd3d.c
+++ b/src/osd/windows/drawd3d.c
@@ -892,15 +892,15 @@ static int device_create_resources(d3d_info *d3d)
static void device_delete(d3d_info *d3d)
{
- // free our effects
- d3d->hlsl->delete_resources();
-
// delete the HLSL interface
global_free(d3d->hlsl);
- // free resources
+ // free our base resources
device_delete_resources(d3d);
+ // free our effects
+ d3d->hlsl->delete_resources();
+
// free the device itself
if (d3d->device != NULL)
(*d3dintf->device.release)(d3d->device);
@@ -921,11 +921,20 @@ static void device_delete_resources(d3d_info *d3d)
d3d_texture_info *tex = d3d->texlist;
d3d->texlist = tex->next;
if (tex->d3dfinaltex != NULL)
+ {
(*d3dintf->texture.release)(tex->d3dfinaltex);
+ tex->d3dfinaltex = NULL;
+ }
if (tex->d3dtex != NULL && tex->d3dtex != tex->d3dfinaltex)
+ {
(*d3dintf->texture.release)(tex->d3dtex);
+ tex->d3dtex = NULL;
+ }
if (tex->d3dsurface != NULL)
+ {
(*d3dintf->surface.release)(tex->d3dsurface);
+ tex->d3dsurface = NULL;
+ }
global_free(tex);
}