[MPlayer-cvslog] r34354 - trunk/libvo/vo_direct3d.c

al subversion at mplayerhq.hu
Sat Nov 19 15:04:12 CET 2011


Author: al
Date: Sat Nov 19 15:04:11 2011
New Revision: 34354

Log:
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)).

Modified:
   trunk/libvo/vo_direct3d.c

Modified: trunk/libvo/vo_direct3d.c
==============================================================================
--- trunk/libvo/vo_direct3d.c	Wed Nov 16 12:14:25 2011	(r34353)
+++ trunk/libvo/vo_direct3d.c	Sat Nov 19 15:04:11 2011	(r34354)
@@ -237,6 +237,12 @@ static int create_d3d_surfaces(void)
         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_alpha(int x0, int y0, i
 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)) {


More information about the MPlayer-cvslog mailing list