mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 11:40:29 +02:00
lcl gtk: fixed mem leak
git-svn-id: trunk@63635 -
This commit is contained in:
parent
9ce85ae018
commit
b45ee007da
@ -1444,9 +1444,8 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
If RGN = nil then
|
If RGN = nil then
|
||||||
Result := ERROR
|
Result := ERROR
|
||||||
else
|
else if gdk_region_empty(RGN) then
|
||||||
If gdk_region_empty(RGN) then
|
Result := NULLREGION
|
||||||
Result := NULLREGION
|
|
||||||
else begin
|
else begin
|
||||||
gdk_region_get_clipbox(RGN,@aRect);
|
gdk_region_get_clipbox(RGN,@aRect);
|
||||||
SimpleRGN := gdk_region_rectangle(@aRect);
|
SimpleRGN := gdk_region_rectangle(@aRect);
|
||||||
|
@ -1838,42 +1838,46 @@ begin
|
|||||||
and IsValidGDIObject(Src2);
|
and IsValidGDIObject(Src2);
|
||||||
if not Continue then begin
|
if not Continue then begin
|
||||||
DebugLn('WARNING: [TGtk2WidgetSet.CombineRgn] Invalid HRGN');
|
DebugLn('WARNING: [TGtk2WidgetSet.CombineRgn] Invalid HRGN');
|
||||||
Result := Error;
|
exit(Error);
|
||||||
end
|
end;
|
||||||
else begin
|
if DObj^.RefCount>1 then
|
||||||
S1 := S1Obj^.GDIRegionObject;
|
begin
|
||||||
S2 := S2Obj^.GDIRegionObject;
|
DebugLn('WARNING: [TGtk2WidgetSet.CombineRgn] Invalid Dest');
|
||||||
//DebugLn('TGtk2WidgetSet.CombineRgn A fnCombineMode=',Dbgs(fnCombineMode));
|
exit(RegionType(DObj^.GDIRegionObject));
|
||||||
case fnCombineMode of
|
end;
|
||||||
RGN_AND :
|
|
||||||
D := PGDKRegion(gdk_region_intersect(S1, S2));
|
S1 := S1Obj^.GDIRegionObject;
|
||||||
RGN_COPY :
|
S2 := S2Obj^.GDIRegionObject;
|
||||||
D := gdk_region_copy(S1);
|
//DebugLn('TGtk2WidgetSet.CombineRgn A fnCombineMode=',Dbgs(fnCombineMode));
|
||||||
RGN_DIFF :
|
case fnCombineMode of
|
||||||
D := PGDKRegion(gdk_region_subtract(S1, S2));
|
RGN_AND :
|
||||||
RGN_OR :
|
D := PGDKRegion(gdk_region_intersect(S1, S2));
|
||||||
D := PGDKRegion(gdk_region_union(S1, S2));
|
RGN_COPY :
|
||||||
RGN_XOR :
|
D := gdk_region_copy(S1);
|
||||||
D := PGDKRegion(gdk_region_xor(S1, S2));
|
RGN_DIFF :
|
||||||
else begin
|
D := PGDKRegion(gdk_region_subtract(S1, S2));
|
||||||
Result:= ERROR;
|
RGN_OR :
|
||||||
D := nil;
|
D := PGDKRegion(gdk_region_union(S1, S2));
|
||||||
end;
|
RGN_XOR :
|
||||||
end;
|
D := PGDKRegion(gdk_region_xor(S1, S2));
|
||||||
if Assigned(DObj^.GDIRegionObject) then
|
else begin
|
||||||
gdk_region_destroy(DObj^.GDIRegionObject);
|
Result:= ERROR;
|
||||||
DObj^.GDIRegionObject := D;
|
D := nil;
|
||||||
Result := RegionType(D);
|
|
||||||
//DebugLn('TGtk2WidgetSet.CombineRgn B Mode=',dbgs(fnCombineMode),
|
|
||||||
// ' S1=',GDKRegionAsString(S1),' S2=',GDKRegionAsString(S2),' D=',GDKRegionAsString(D),'');
|
|
||||||
if (Result = NullRegion) and
|
|
||||||
((RegionType(S1) <> NullRegion) or ((RegionType(S2) <> NullRegion))) then
|
|
||||||
begin
|
|
||||||
DeleteObject(Dest);
|
|
||||||
Dest := CreateEmptyRegion;
|
|
||||||
Result := RegionType(D);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
if Assigned(DObj^.GDIRegionObject) then
|
||||||
|
gdk_region_destroy(DObj^.GDIRegionObject);
|
||||||
|
DObj^.GDIRegionObject := D;
|
||||||
|
Result := RegionType(D);
|
||||||
|
//DebugLn('TGtk2WidgetSet.CombineRgn B Mode=',dbgs(fnCombineMode),
|
||||||
|
// ' S1=',GDKRegionAsString(S1),' S2=',GDKRegionAsString(S2),' D=',GDKRegionAsString(D),'');
|
||||||
|
{if (Result = NullRegion) and
|
||||||
|
((RegionType(S1) <> NullRegion) or ((RegionType(S2) <> NullRegion))) then
|
||||||
|
begin
|
||||||
|
DeleteObject(Dest);
|
||||||
|
Dest := CreateEmptyRegion;
|
||||||
|
Result := RegionType(Dest);
|
||||||
|
end;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user