Recent

Author Topic: SIGSEGV exception for TShape controls  (Read 1617 times)

Jonvy

  • Jr. Member
  • **
  • Posts: 90
SIGSEGV exception for TShape controls
« on: February 24, 2018, 07:06:09 am »
I get the following SIGSEGV exception for TShape controls,but I don't know the reason and how to solve this problem?Can you help me?

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: SIGSEGV exception for TShape controls
« Reply #1 on: February 24, 2018, 07:14:51 am »
make sure that you check if the Target is actually containing a valid class value.

If Assigned(Target) then if (Target as TShape).name = 'xxxx' then
begin
end;

or better yet:
If target is TShape then if TShape(Target).name = '' then
begin
end;

or the easy way out (as first statement in your function):
if not assigned(Target) then exit
« Last Edit: February 24, 2018, 07:19:18 am by molly »

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: SIGSEGV exception for TShape controls
« Reply #2 on: February 24, 2018, 04:55:50 pm »
I can't be exactly sure but memory seems to tell me if you create TShape for example at runtime
the NAME is not filled out.. Of course I could be wrong in that assumption but it seems it would make
sense in part as how the OI does it for auto loads.
The only true wisdom is knowing you know nothing

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: SIGSEGV exception for TShape controls
« Reply #3 on: February 26, 2018, 03:04:38 am »
Thanks Molly,the problem sovled! :D
make sure that you check if the Target is actually containing a valid class value.

If Assigned(Target) then if (Target as TShape).name = 'xxxx' then
begin
end;

or better yet:
If target is TShape then if TShape(Target).name = '' then
begin
end;

or the easy way out (as first statement in your function):
if not assigned(Target) then exit

 

TinyPortal © 2005-2018