From 0e92bbef2f11f28ba96a50d01f98fba74ebc4891 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 31 Dec 2011 17:14:04 +0100 Subject: vo_direct3d: fix crash when repeatedly reinitializing an uncooperative device --- libvo/vo_direct3d.c | 6 ++++-- 1 file 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; -- cgit v1.2.3