The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,598 other followers

android – How to release a Firemonkey control properly, in this case a child form with a parent? – Stack Overflow

Posted by jpluimers on 2019/01/02

For my archive as [Archive.is] TFmxObject.Release is deprecated since Delphi 10.2 Tokyo, and – worse – broken on some platforms: [WayBack] android – How to release a Firemonkey control properly, in this case a child form with a parent? – Stack Overflow

TFmxObject.Release uses TThread.ForceQueue internally, and that’s currently broken under Android (see discussion above).

As a workaround, a working cross-platform version for releasing an object from its event handler would be

procedure TForm.CloseBtnClick(Sender: TObject);
begin
  Parent := nil;
  TThread.CreateAnonymousThread(
  procedure
  begin
    TThread.Synchronize(nil,
    procedure
    begin
      Self.DisposeOf;
    end);
  end).Start;
end;

Instead of Synchronize you can also use Queue in above method.

What is important to keep in mind is that you should not keep any other references to the control you are releasing or you may hit the trouble down the road.

Via:

[WayBack] What are the solutions for a wizard like application (a single form with content changed depending on some action) in Firemonkey?

I’ve been using TFormStand to have a single form and load frames dynamically, but have some AV in the stept when changing frames…. –

R Gosp – Google+

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: