Recent

Author Topic: From Form_Tutorial#The_First_GUI_Application: raised exception 'External SIGSEGV  (Read 2235 times)

wp

  • Hero Member
  • *****
  • Posts: 11853
Oh sorry, I did not think that the attachment was at the first post...

Peter H

  • Sr. Member
  • ****
  • Posts: 272
The application tries to display Form3 but Form3 was not created:
Code: Pascal  [Select][+][-]
  1. program TestCallingForms_pj;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Interfaces, // this includes the LCL widgetset
  10.   Forms,
  11.   TestCallingForms_Main, testcallingforms_01 , testcallingforms_02
  12.   { you can add units after this };
  13.  
  14. {$R *.res}
  15.  
  16. begin
  17.   RequireDerivedFormResource:=True;
  18.   Application.Scaled:=True;
  19.   Application.Initialize;
  20.   Application.CreateForm(TForm1, Form1);
  21.   //Application.CreateForm(TForm2, Form2);
  22.   //Application.CreateForm(TForm3, Form3); //<- if this is uncommented, the Sigsev doesnt occur
  23.   Application.Run;
  24. end.
  25.  

Howto find this:
Looking in Google for the access violation doesnt help.
The error message shows where the access violation occured, the file and line number.
Goto this location (while debugging) and display the Call Stack.
Look in the call stack for a procedure you wrote, see that "Form3" is accessed in this procedure.
Search for all references to Form3 and see the Form was never created.
« Last Edit: November 28, 2020, 10:00:45 pm by Peter H »

HansDouwe

  • New member
  • *
  • Posts: 9
Hello SA Blackmon and his helpers,

Is there a solution for this problem?
Also I'm a new user of platform Lazarus.
And also in my stiuation raised sometimes (not always) this error.
I'm also using an acer latop.
I've installed Lazarus V2.0.10 (32-bits) on Windows  10.

It look like this error is raising sometimes before the debugger starts my program.
Even if I stop the program and reset de debugger before.
When I try often enough, then suddenly the debugger starts my program again.
I don't see a system, when this error is raising and when not.
 
I don't understand why this happens and I can not find the reason of this error.

Does this look like the same problem that was discussed here?


HansDouwe

  • New member
  • *
  • Posts: 9
Continued last post:

I'm not using forms.

Peter H

  • Sr. Member
  • ****
  • Posts: 272
@HansDouwe:
There is a common problem with Lazarus 32 Bit: If "Automatic" is choosen as type of debugging info, Lazarus chooses the "Stabs" format, which is outdated for Windows.

Goto Project/Project options/Compiler Options/Debugging in Lazarus Menu and choose "Dwarf with sets" as debugger info.
If the problem persists, more about your project must be known.
You can easily export respective "publish" your project to a zip file in Lazarus and post it here, so others can try it.

HansDouwe

  • New member
  • *
  • Posts: 9
Hi Peter,

You're a genius.
I've changed de debugsetting in Lazarus 32 and debugging of my programs is going perfectly now (without any probelms)
I put a lot of time into solving this problem because I thought there was a problem in my code, but I would never have found this.

You've saved me a lot of troubles and now I can work much faster.

Thank you very much.


Peter H

  • Sr. Member
  • ****
  • Posts: 272
Glad to hear this!
I fear I am not a genius, but a rather green newbie with lazarus. (not a newbie with programming in common)
I had similar problems with debugger when I started and a friendly oldtimer here teached me this.
Maybe this should be hardcoded into lazarus, I fear, many newbies stumble upon this.

all the Best,

Peter

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
The Wiki Windows Portal has plenty of useful information for using Lazarus + FPC on Windows, especially the Windows Programming Tips article.

 

TinyPortal © 2005-2018