summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-12-31 17:14:04 +0100
committerwm4 <wm4@mplayer2.org>2012-03-17 21:06:30 +0100
commit0e92bbef2f11f28ba96a50d01f98fba74ebc4891 (patch)
treeec1bdaf12cff89b6a16efc71655b3324960b77c1
parentda4dd6d14ba9e29cb9d519f8e4dfec6966121450 (diff)
downloadmpv-0e92bbef2f11f28ba96a50d01f98fba74ebc4891.tar.bz2
mpv-0e92bbef2f11f28ba96a50d01f98fba74ebc4891.tar.xz
vo_direct3d: fix crash when repeatedly reinitializing an uncooperative device
-rw-r--r--libvo/vo_direct3d.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index 061c4e750e..b8237ef58b 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -830,14 +830,16 @@ static int reconfigure_d3d(d3d_priv *priv)
destroy_d3d_surfaces(priv);
- IDirect3DDevice9_Release(priv->d3d_device);
+ if (priv->d3d_device)
+ IDirect3DDevice9_Release(priv->d3d_device);
priv->d3d_device = NULL;
// Force complete destruction of the D3D state.
// Note: this step could be omitted. The resize_d3d call below would detect
// that d3d_device is NULL, and would properly recreate it. I'm not sure why
// the following code to release and recreate the d3d_handle exists.
- IDirect3D9_Release(priv->d3d_handle);
+ if (priv->d3d_handle)
+ IDirect3D9_Release(priv->d3d_handle);
priv->d3d_handle = NULL;
if (!init_d3d(priv))
return 0;