Help - Search - Members - Calendar
Full Version: Bug-Report
Fast Reports forum > Fast Reports Products > FastReport 4.0
Deep-Sea
Sry, but I have not found a better place to report bugs. Is this forum really the best place? smile.gif

Back to topic: There is a bug in the function "DrawBitmap" in the unit "frxUtils.pas" (version 4.9). The created dc (with "CreateCompatibleDC") will never be freed by call "DeleteDC".

Original code:
CODE
procedure DrawBitmap(aHandle: HDC; Dest: TRect; Bitmap: TBitmap);
var
  hMemDC: HDC;
  PrevStretchBltMode: Integer;
begin
  hMemDC := CreateCompatibleDC(aHandle);
  SelectObject(hMemDC, Bitmap.Handle);
  PrevStretchBltMode := SetStretchBltMode(aHandle, STRETCH_HALFTONE);
  with Dest do
    StretchBlt(aHandle, Left, Top, Right - Left, Bottom - Top, hMemDC,
          0, 0, Bitmap.Width, Bitmap.Height, SRCCOPY);
  SetStretchBltMode(aHandle, PrevStretchBltMode);
end;

Fixed code:
CODE
procedure DrawBitmap(aHandle: HDC; Dest: TRect; Bitmap: TBitmap);
var
  hMemDC: HDC;
  PrevStretchBltMode: Integer;
begin
  hMemDC := CreateCompatibleDC(aHandle);
  try
    SelectObject(hMemDC, Bitmap.Handle);
    PrevStretchBltMode := SetStretchBltMode(aHandle, STRETCH_HALFTONE);
    with Dest do
      StretchBlt(aHandle, Left, Top, Right - Left, Bottom - Top, hMemDC,
            0, 0, Bitmap.Width, Bitmap.Height, SRCCOPY);
    SetStretchBltMode(aHandle, PrevStretchBltMode);
  finally
    DeleteDC(hMemDC);
  end;
end;

When many pictures will be (re)painted, the application crashed with out-of-resources exceptions.
(Is it possible that this kind of bugs are also in other functions? unsure.gif)
Anu de Deus
Well, that explains a few problems I had!
It seems to me that you have the Professional license, so if I were you, I would open a support ticket, instead of relying on this forum to have it fixed. Just go to the FastReports Customer area -> support, and you should find a link there to request support.
Thanks for the info anyway.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.