Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Dynamic component results in segmentation fault?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0 Threads: [ Previous | Next ]
Free Dorfman

Posts: 139
Registered: 2/4/12
Dynamic component results in segmentation fault?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 17, 2017 8:40 AM
Delphi | Seattle 10 Update 1 | Android

I have a series of Frames that are displayed, one at a time, inside a Layout. I have a Reposition routine that I call "AtFirstShowing" and in response to a change in Orientation, via SubscribeToMessage(TOrientationChangedMessage...

At any rate, all was fine except for some minor adjustments to a Label's Size and Position. So I added the following snippet to "highlight" the Label by giving it a Client-aligned, low-Opacity Rectangle as a child. This is a technique I employ frequently, although not quite in this fashion.

So, I added the following code to create the Rectangle just once (the first time the routine is called):

if Lbl.FindComponent('R') = nil then
  with TRectangle.Create(Lbl) do
    begin
    Name := 'R';
    Parent := Lbl;
    Align := TAlignLayout.Client;
    Stroke.Kind := TBrushKind.None;
    Fill.Color := TAlphaColorRec.LightCyan;
    Opacity := 0.5;
    end;


Note: I normally loathe with statements. One is used here as (a) this is temporary [testing] code; (b) it allows me to not have to create additional local variables - which allows for commenting the code out [and keeping a clean compile - no hints; no warnoings] is just one place.

Everything looks as I want. And no memory leaks under Windows. But... under Android, I get a segmentation fault (11) on app shutdown.

Is there a fairly obvious reason for this? What am I missing here? Thanks.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02