Last FWH version. Memory leak.

Re: Last FWH version. Memory leak.

Postby carlos vargas » Fri Feb 15, 2013 9:05 pm

Antonio

entonces la linea
Code: Select all  Expand view

    lpBits = ( LPBYTE ) hb_xgrab( iXsize * iYsize * 2 );
    if( lpBits )
    {
    }
    hb_xfree( lpBits );
 

estaria de mas, ya que no se estaria usando ese dato (tamano en byte del bitmap), no deberia eliminarse?
y el codigo contenido en el bloque, sacarlo fuera.
salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1720
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Last FWH version. Memory leak.

Postby Antonio Linares » Fri Feb 15, 2013 9:31 pm

Carlos,

Si, de hecho en las modificaciones nuestras ya lo hemos eliminado :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Last FWH version. Memory leak.

Postby Marco Turco » Wed Feb 20, 2013 10:22 am

Hi Antonio,
I didn't understand if the problem has been solved and if affirmative which is the new code to use. Thanks.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Last FWH version. Memory leak.

Postby Antonio Linares » Wed Feb 20, 2013 11:54 am

Marco,

Solved. There was a bug in the code and we have shown how to fix it :-)

It will be included in FWH 13.02

This code has to be replaced in FWH\source\function\fwbmp.c
Code: Select all  Expand view
void TransBmp( HBITMAP hBitmap, int iXsize, int iYsize,
               COLORREF rgbTransparent, HDC hDC,
               int iXOffset, int iYOffset, int iWidth, int iHeight )
{
  HDC mDC, nDC;
  HBITMAP hMask, hBmOld1, hBmOld2;

  mDC = CreateCompatibleDC( hDC );
 
  if( mDC )
  {
    hBmOld1 = ( HBITMAP ) SelectObject( mDC, hBitmap );

    hMask = CreateBitmap( iXsize, iYsize, 1, 1, NULL );
   
    if( hMask )
    {
       nDC = CreateCompatibleDC( hDC );
       
       if( nDC )
       {
          hBmOld2 = ( HBITMAP ) SelectObject( nDC, hMask );
          SetBkColor( mDC, rgbTransparent );

          BitBlt( nDC, 0, 0, iXsize, iYsize, mDC, 0, 0, SRCCOPY );

          SetStretchBltMode( hDC, COLORONCOLOR );

          StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
                      mDC, 0, 0, iXsize, iYsize,
                      SRCINVERT );

          StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
                      nDC, 0, 0, iXsize, iYsize,
                      SRCAND );

          StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
                      mDC, 0, 0, iXsize, iYsize,
                      SRCINVERT );

          SelectObject( nDC, hBmOld2 );
          DeleteDC( nDC );
        }
        DeleteObject( hMask );
    }
    SelectObject( mDC, hBmOld1 );
    DeleteDC( mDC );
  }
}
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 37 guests