Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-07

Gtk2 missed try-finally

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexey

gtk2proc.inc, procedure DrawImageListIconOnWidget: it allocates Bitmap + DC. Pls add try-finally for Bitmap; and (not sure) try-finally for DC:

     finally
       ReleaseDC(HDC({%H-}PtrUInt(DestWidget)),DestDC);
     end;
   finally
     Bitmap.Free;
   end;
Regards, Alexey

Reply by email

Mattias Gaertner
to Alexey
gtk2proc.inc, procedure DrawImageListIconOnWidget: it allocates Bitmap + DC. Pls add try-finally for Bitmap; and (not sure) try-finally for DC:

How did you manage to create a mem leak there?

Show quoted text 6 lines
finally ReleaseDC(HDC({%H-}PtrUInt(DestWidget)),DestDC); end; finally Bitmap.Free; end;

Mattias

Reply by email