mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 02:19:37 +02:00
gtk2: fixed Gtk2WidgetSet.ClipboardGetData mem leak on stream write error
git-svn-id: trunk@36788 -
This commit is contained in:
parent
2fd5ebfb38
commit
8e2c46f2b0
@ -2783,7 +2783,6 @@ begin
|
||||
FillByte(BitInfo,SizeOf(BitInfo),0);
|
||||
|
||||
if (DC=0) or (Usage=0) then ;
|
||||
|
||||
if not IsValidGDIObject(Bitmap)
|
||||
then begin
|
||||
DebugLn('WARNING: [TGtk2WidgetSet.InternalGetDIBits] invalid Bitmap!');
|
||||
|
@ -1,5 +1,4 @@
|
||||
{%MainUnit gtk2int.pas}
|
||||
{ $Id$ }
|
||||
|
||||
{******************************************************************************
|
||||
All GTK Winapi implementations.
|
||||
@ -416,15 +415,19 @@ begin
|
||||
// the lcl expects the return format as simple text
|
||||
// transform if necessary
|
||||
if FormatAtom=gdk_atom_intern('COMPOUND_TEXT',GdkTrue) then begin
|
||||
CompoundTextList:=nil;
|
||||
CompoundTextCount:=gdk_text_property_to_text_list(SelData._Type,
|
||||
SelData.Format,SelData.Data,SelData.Length,CompoundTextList);
|
||||
{$IfDef DEBUG_CLIPBOARD}
|
||||
DebugLn('[TGtk2WidgetSet.ClipboardGetData] D CompoundTextCount=',dbgs(CompoundTextCount),' Now=',dbgs(Now));
|
||||
{$EndIf}
|
||||
for i:=0 to CompoundTextCount-1 do
|
||||
if (CompoundTextList[i]<>nil) then
|
||||
Stream.Write(CompoundTextList[i]^,StrLen(CompoundTextList[i]));
|
||||
gdk_free_text_list(CompoundTextList);
|
||||
try
|
||||
{$IfDef DEBUG_CLIPBOARD}
|
||||
DebugLn('[TGtk2WidgetSet.ClipboardGetData] D CompoundTextCount=',dbgs(CompoundTextCount),' Now=',dbgs(Now));
|
||||
{$EndIf}
|
||||
for i:=0 to CompoundTextCount-1 do
|
||||
if (CompoundTextList[i]<>nil) then
|
||||
Stream.Write(CompoundTextList[i]^,StrLen(CompoundTextList[i]));
|
||||
finally
|
||||
gdk_free_text_list(CompoundTextList);
|
||||
end;
|
||||
end else
|
||||
Stream.Write(SelData.Data^,SelData.Length);
|
||||
end else begin
|
||||
@ -1207,8 +1210,6 @@ end;
|
||||
Function: CreateCompatibleDC
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtk2WidgetSet.CreateCompatibleDC(DC: HDC): HDC;
|
||||
var
|
||||
@ -1217,6 +1218,8 @@ begin
|
||||
Result := 0;
|
||||
pNewDC := NewDC;
|
||||
|
||||
// ToDo: TGtk2WidgetSet.CreateCompatibleDC: when is a DC compatible?
|
||||
|
||||
// do not copy
|
||||
// In a compatible DC you have to select a bitmap into it
|
||||
(*
|
||||
@ -2639,7 +2642,7 @@ var
|
||||
LeftPos: Longint;
|
||||
begin
|
||||
if LeftOffset <> DT_LEFT then
|
||||
GetTextExtentPoint(DC, theLine, LineLength, Points[0]);
|
||||
GetTextExtentPoint(DC, theLine, LineLength, {%H-}Points[0]);
|
||||
|
||||
if TempBrush = HBRUSH(-1) then
|
||||
TempBrush := SelectObject(DC, GetStockObject(NULL_BRUSH));
|
||||
@ -2844,7 +2847,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtk2WidgetSet.EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean;
|
||||
begin
|
||||
//TODO: Implement this;
|
||||
// TODO: implement TGtk2WidgetSet.EnableScrollBar
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
@ -5664,7 +5667,7 @@ begin
|
||||
P := GetStyleWidget(lgsHorizontalScrollbar);
|
||||
if P <> nil then
|
||||
begin
|
||||
FillChar(AValue, SizeOf(AValue), 0);
|
||||
FillChar(AValue{%H-}, SizeOf(AValue), 0);
|
||||
g_value_init(@AValue, G_TYPE_INT);
|
||||
gtk_widget_style_get_property(P, 'slider-width', @AValue);
|
||||
Result := AValue.data[0].v_int;
|
||||
|
@ -85,7 +85,7 @@ function DrawEdge(DC: HDC; var ARect: TRect; Edge: Cardinal; grfFlags: Cardinal)
|
||||
function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer; override;
|
||||
|
||||
function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean; override;
|
||||
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; override;
|
||||
function EnableScrollBar({%H-}Wnd: HWND; {%H-}wSBflags, {%H-}wArrows: Cardinal): Boolean; override;
|
||||
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
|
||||
function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; override;
|
||||
procedure EnterCriticalSection(var CritSection: TCriticalSection); override;
|
||||
|
Loading…
Reference in New Issue
Block a user