Gtk2: do not crash inside PtInRegion if passed handle is not of HRGN type. issue #27080

git-svn-id: trunk@47056 -
This commit is contained in:
zeljko 2014-12-02 08:25:57 +00:00
parent d514d21370
commit 49d77cd1cc

View File

@ -7041,8 +7041,17 @@ end;
------------------------------------------------------------------------------}
function TGtk2WidgetSet.PtInRegion(RGN: HRGN; X, Y: Integer): Boolean;
begin
//todo: sanity checks for valid handle etc. eg. like CombineRgn
Result := gdk_region_point_in({%H-}PGdiObject(RGN)^.GDIRegionObject, X, Y);
Result := False;
if not IsValidGDIObject(RGN) then
exit;
if (PGdiObject(RGN)^.GDIBitmapObject <> nil) or
(PGdiObject(RGN)^.GDIPixbufObject <> nil) or
(PGdiObject(RGN)^.GDIPixmapObject.Image <> nil) then
begin
// issue #27080
Result := False;
end else
Result := gdk_region_point_in({%H-}PGdiObject(RGN)^.GDIRegionObject, X, Y);
end;
{------------------------------------------------------------------------------