Previous 15994 Revisions Next

r13296 Friday 18th November, 2011 at 07:00:27 UTC by MooglyGuy
[OSD] Fixed HLSL memory leak and 32-bit HLSL crash-on-exit. [Ryan Holtz, Bat Country Entertainment]
[src/osd/windows]d3dhlsl.c drawd3d.c

src/osd/windows/drawd3d.c
r13295r13296
892892
893893static void device_delete(d3d_info *d3d)
894894{
895   // free our effects
896   d3d->hlsl->delete_resources();
897
898895   // delete the HLSL interface
899896   global_free(d3d->hlsl);
900897
901   // free resources
898   // free our base resources
902899   device_delete_resources(d3d);
903900
901   // free our effects
902   d3d->hlsl->delete_resources();
903
904904   // free the device itself
905905   if (d3d->device != NULL)
906906      (*d3dintf->device.release)(d3d->device);
r13295r13296
921921      d3d_texture_info *tex = d3d->texlist;
922922      d3d->texlist = tex->next;
923923      if (tex->d3dfinaltex != NULL)
924      {
924925         (*d3dintf->texture.release)(tex->d3dfinaltex);
926         tex->d3dfinaltex = NULL;
927      }
925928      if (tex->d3dtex != NULL && tex->d3dtex != tex->d3dfinaltex)
929      {
926930         (*d3dintf->texture.release)(tex->d3dtex);
931         tex->d3dtex = NULL;
932      }
927933      if (tex->d3dsurface != NULL)
934      {
928935         (*d3dintf->surface.release)(tex->d3dsurface);
936         tex->d3dsurface = NULL;
937      }
929938      global_free(tex);
930939   }
931940
src/osd/windows/d3dhlsl.c
r13295r13296
11//============================================================
22//
3//  drawd3d.c - Win32 Direct3D HLSL implementation
3//  d3dhlsl.c - Win32 Direct3D HLSL implementation
44//
55//============================================================
66//
r13295r13296
213213
214214hlsl_info::~hlsl_info()
215215{
216   global_free(options);
217
218   if(shadow_bitmap != NULL)
219   {
220      global_free(shadow_bitmap);
221      shadow_bitmap = NULL;
222   }
216223}
217224
218225
r13295r13296
17341741            if(target_in_use[index] != NULL)
17351742            {
17361743               d3d_texture_info *tex = target_in_use[index];
1737
1738               if(d3d->texlist == tex)
1744               bool found_in_active_list = false;
1745               d3d_texture_info *test_tex = d3d->texlist;
1746               while (test_tex != NULL)
17391747               {
1740                  d3d->texlist = tex->next;
1741                  if(d3d->texlist != NULL)
1748                  if(test_tex == tex)
17421749                  {
1743                     d3d->texlist->prev = NULL;
1750                     found_in_active_list = true;
1751                     break;
17441752                  }
1753                  test_tex = test_tex->next;
17451754               }
1746               else
1755
1756               // only clean up a texture if it won't be cleaned up by drawd3d
1757               if(!found_in_active_list)
17471758               {
1748                  if(tex->next != NULL)
1759                  if (tex->d3dfinaltex != NULL)
17491760                  {
1750                     tex->next->prev = tex->prev;
1761                     (*d3dintf->texture.release)(tex->d3dfinaltex);
1762                     tex->d3dfinaltex = NULL;
17511763                  }
1752                  if(tex->prev != NULL)
1764                  if (tex->d3dtex != NULL && tex->d3dtex != tex->d3dfinaltex)
17531765                  {
1754                     tex->prev->next = tex->next;
1766                     (*d3dintf->texture.release)(tex->d3dtex);
1767                     tex->d3dtex = NULL;
17551768                  }
1769                  if (tex->d3dsurface != NULL)
1770                  {
1771                     (*d3dintf->surface.release)(tex->d3dsurface);
1772                  }
1773                  global_free(tex);
17561774               }
1757
1758               if (tex->d3dfinaltex != NULL)
1759                  (*d3dintf->texture.release)(tex->d3dfinaltex);
1760               if (tex->d3dtex != NULL && tex->d3dtex != tex->d3dfinaltex)
1761                  (*d3dintf->texture.release)(tex->d3dtex);
1762               if (tex->d3dsurface != NULL)
1763                  (*d3dintf->surface.release)(tex->d3dsurface);
1764               global_free(tex);
17651775            }
17661776
17671777            if (prescaletexture0[index] != NULL)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team