Einzelnen Beitrag anzeigen

tueddy

Registriert seit: 3. Jan 2007
21 Beiträge
 
#30

AW: Der XE8 Fehler-Thread

  Alt 8. Apr 2015, 15:40
[MacOS] FMX ScreenReader can crash the application! (berichtet am 11.02.2015)

In FMX.ScreenReader.MAC.pas the is a global variable "FocusedCtrl".
If a second form is shown & freed, the variable FocusedCtrl can point to a control which has already been freed.

In various places the variable is accessed and can be a dangling pointer -> BUUUM

Workaround in FMX.ScreenReader.MAC.pas:
Code:
destructor TAccForm.Destroy;
var
  MyControl: TFmxObject;
begin
  FEditTimer.Free;
  FEditMouseUp.Free;

  // Make sure freed form has no longer reference to control
  MyControl:= FocusedCtrl;
  while Assigned(MyControl) do
    begin
      if (MyControl is TForm) and ((MyControl as TForm) = Self) then
        begin
          FocusedCtrl:= nil;
          Break;
        end;
      MyControl:= MyControl.Parent;
    end;
  inherited;
end;
  Mit Zitat antworten Zitat