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