Bug-Report

Sry, but I have not found a better place to report bugs. Is this forum really the best place? [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="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:[/img]
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:
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? >)

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 5:34AM
    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.