Permalink
Browse files

Silence sporadic EAccessViolation when accessing TWinControl.Parent

  • Loading branch information...
ansgarbecker committed Jan 6, 2019
1 parent bd2d192 commit 96dfef604645a9185fc782cc2e5742533f3bb9a7
Showing with 6 additions and 1 deletion.
  1. +6 −1 source/apphelpers.pas
@@ -2186,7 +2186,12 @@ function GetParentFormOrFrame(Comp: TWinControl): TWinControl;
begin
Result := Comp;
while True do begin
Result := Result.Parent;
try
Result := Result.Parent;
except
on E:EAccessViolation do
Break;
end;
// On a windows shutdown, GetParentForm() seems sporadically unable to find the owner form
// In that case we would cause an exception when accessing it. Emergency break in that case.
// See issue #1462

0 comments on commit 96dfef6

Please sign in to comment.