[vlc-devel] directx.c: GDI object without handle

Javier Martinez jamarno at doctor.upv.es
Thu Jun 29 18:21:39 CEST 2006


/Hello Gildas,

I am writting you as you appear as the main developer of the file 
directx.c in the application VLC.

There is a little "bug" in this file (lines 860-862):

/  //* set the colorkey as the backgound brush for the video window *//  
<http://trac.videolan.org/vlc/browser/trunk/modules/video_output/directx/directx.c#L861> 

SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND,       
        (LONG)CreateSolidBrush( p_vout->p_sys->i_rgb_colorkey ) );
/
In this command, /CreateSolidBrush is called inside of another function 
and the pointer to the brush is lost.
Due to that, each time that the function is called, a GDI object remains 
in memory.

If you want destroy the brush object, you can divide this sentence as 
follows:

1. Add an attribute of type brush in the struct vout_sys_t
      File:   modules/video_output/directx/vout.h*
      HBRUSH      brush;
*
2. Divide actual command:  

     /* Create the actual brush */
*    p_vout->p_sys->brush = CreateSolidBrush( 
p_vout->p_sys->i_rgb_colorkey );
*
    SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND,
                  *(LONG)p_vout->p_sys->brush* );
/


3. Delete de brush object in the function DirectXCloseDisplay:

     static void DirectXCloseDisplay( vout_thread_t *p_vout )
     {
        msg_Dbg( p_vout, "DirectXCloseDisplay" );

*         if( p_vout->p_sys->brush != NULL )
         {
             DeleteObject( p_vout->p_sys->brush);
        }
*
       [ .... ]


I hope this message helps you to correct the file. Kind Regards,
/

-- 

                    ''~``
                   ( o o )
 +------------.oooO--(_)--Oooo.-------------+
 |                                          |
 |         Javier Martínez Nohalés          |
 |      Departamento de Comunicaciones      |
 |   Universidad Politécnica de Valencia    |
 |        Tel: 963877000 Ext:73004          |
 |             .oooO                        |
 |             (   )   Oooo.                |
 +--------------\ (----(   )----------------+
                 \_)    ) /
                       (_/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20060629/95225f95/attachment.html>


More information about the vlc-devel mailing list