Recent

Author Topic: Project raises exception class "External SIGSEGV"  (Read 10047 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: Project raises exception class "External SIGSEGV"
« Reply #15 on: July 17, 2018, 05:17:25 pm »
You shouldn't cross reference units. Use unit 2 in unit 1 or unit 1 in unit 2, but not both. Also, it would be helpful if you provide the source. Otherwise there's no way anyone can help.
Nonsense. The compiler catches that at compile time...
Your advice about introducing a third unit, however is somewhat correct, but not related to an external SIGSEV.
You should have explained that unit references can be resolved by adding one to the interface and the other to the implementation section. (Common knowledge, even basic knowledge).
In the case that it is unresolvable your suggestion is correct, but not for the original problem. So he is still stuck...
If he gives us compilable code, it can be resolved much quicker. (doesn't have to work, but a full project that demonstrates the issue.
Specialize a type, not a var.

passt

  • New member
  • *
  • Posts: 9
Re: Project raises exception class "External SIGSEGV"
« Reply #16 on: July 17, 2018, 05:25:01 pm »
Quote
So when you comment out the code in tform2.myproc3 everything seems to work as expected? Can you create the smallest compilable complete application possible, zip it and post it here?  As for the message  Type TSTRINGLIST has no component named COUNT is the inability of GDB to correctly recognize pascal properties, it has nothing to do with your code.

When I reduce the program to an application for the console, everything works fine and no error is shown. Although it doesn't make any sense to work with three units in this case. Please see the attached project "Neuer Ordner test.zip".

When I use forms and buttons with the same shortened and reduced code, the error still happens. Please see the attached project "Neuer Ordner abas_CSV.7z".
« Last Edit: July 17, 2018, 05:27:40 pm by passt »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Project raises exception class "External SIGSEGV"
« Reply #17 on: July 17, 2018, 06:20:59 pm »
Your main project file needs to create Form2 as well as Form1:

Code: Pascal  [Select][+][-]
  1. begin
  2.   RequireDerivedFormResource:=True;
  3.   Application.Initialize;
  4.   Application.CreateForm(TForm1, Form1);
  5.   Application.CreateForm(TForm2, Form2);
  6.   Application.Run;
  7. end.
and you should delete the TForm2.OnCreate handler, and replace it with a TForm2.OnShow handler:
Code: Pascal  [Select][+][-]
  1. procedure TForm2.FormShow(Sender: TObject);
  2. var
  3.   i: Integer;
  4. begin
  5.   for i := 0 to slFLartikel.Count-1 do showmessage(slFLartikel[i]);
  6. end;

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Project raises exception class "External SIGSEGV"
« Reply #18 on: July 17, 2018, 08:00:55 pm »
You shouldn't cross reference units. Use unit 2 in unit 1 or unit 1 in unit 2, but not both. Also, it would be helpful if you provide the source. Otherwise there's no way anyone can help.
Nonsense. The compiler catches that at compile time...
Your advice about introducing a third unit, however is somewhat correct, but not related to an external SIGSEV.
You should have explained that unit references can be resolved by adding one to the interface and the other to the implementation section. (Common knowledge, even basic knowledge).
In the case that it is unresolvable your suggestion is correct, but not for the original problem. So he is still stuck...
If he gives us compilable code, it can be resolved much quicker. (doesn't have to work, but a full project that demonstrates the issue.
Nonsense, yet somewhat correct. Right! So what's it gonna be? Cross referencing units is bad coding and has no place in structured programming. Period. And nowhere in my comments did I suggest that it would resolve the problem. Just a step in the right direction. I stated multiple times that without compilable code, no help could be given. But thanks for the lecture. you're very good at it.  8-)
« Last Edit: July 17, 2018, 09:56:03 pm by Munair »
keep it simple

passt

  • New member
  • *
  • Posts: 9
Re: Project raises exception class "External SIGSEGV"
« Reply #19 on: July 18, 2018, 12:17:56 pm »
Your main project file needs to create Form2 as well as Form1:
Ah, this was a mistake which I removed for testing purpose only. In the original code still it's in the project file.

and you should delete the TForm2.OnCreate handler, and replace it with a TForm2.OnShow handler:
This did the trick.
Can you explain why the OnCreate event doesn't work for this?

Thanks a lot  :D

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Project raises exception class "External SIGSEGV"
« Reply #20 on: July 18, 2018, 04:55:58 pm »
Can you explain why the OnCreate event doesn't work for this?
OnCreate is invoked when the form is created. If it's in the project file then this will be at program startup. If you try to access an object in that handler that has not (yet) been created you will receive the SIGSEGV. If you access the object in the OnShow handler and create the object before showing the form no error occurs because the object exists.
keep it simple

 

TinyPortal © 2005-2018