# HG changeset patch # User al # Date 1321711451 0 # Node ID a6a1c973de4e85f203cef52bc4203dfbfc0e4e8e # Parent ba55ceb047486ac553da08418f3af025642134e0 vo direct3d: fix crash in osd drawing code The crash occurred when the video window was minimized and the OSD should be drawn. This caused the OSD textures creation to fail and later the OSD drawing code would assume they exist and cause the crash. When the video window is minimized a size change event with the new size 0x0 is reported. This is now handled by deferring the textures recreation. If the OSD should be drawn in the meantime it will be checked if the OSD textures have been allocated. This commit is done with the permission of the vo direct3d maintainer. This is based on patches from Roger Pack (rogerdpack2 (gmail)) and Patrick Dinh (patrickdinh33 (yahoo)). diff -r ba55ceb04748 -r a6a1c973de4e libvo/vo_direct3d.c --- a/libvo/vo_direct3d.c Wed Nov 16 11:14:25 2011 +0000 +++ b/libvo/vo_direct3d.c Sat Nov 19 14:04:11 2011 +0000 @@ -237,6 +237,12 @@ return 0; } + if (!tex_width || !tex_height) { + mp_msg(MSGT_VO, MSGL_V, + "Deferring surface creation because width or height is 0.\n"); + return 0; + } + /* calculate the best size for the OSD depending on the factors from the device */ if (priv->device_caps_power2_only) { tex_width = 1; @@ -1029,7 +1035,8 @@ static void draw_osd(void) { // we can not render OSD if we lost the device e.g. because it was uncooperative - if (!priv->d3d_device) + // or if the OSD textures are not allocated (e.g. the window is minimized) + if (!priv->d3d_device || !priv->d3d_texture_osd) return; if (vo_osd_changed(0)) {