Mercurial > mplayer.hg
changeset 34266:a6a1c973de4e
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)).
author | al |
---|---|
date | Sat, 19 Nov 2011 14:04:11 +0000 |
parents | ba55ceb04748 |
children | 4807501b7405 |
files | libvo/vo_direct3d.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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, + "<vo_direct3d>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)) {