Recent

Author Topic: Showmodal produces: Project raised exception class 'External: SIGSEGV'  (Read 13356 times)

Roger king

  • New Member
  • *
  • Posts: 23
I have a main form with two other forms which are opened using the showmodal command.

One opens without a problem, the other gives the SIGSEGV message. There is no other information, so I don't know how to prevent it.

I have had this problem before and thought that it was a problem with the ModalResult code in the opened form, but in this instance I have compared the form which opens with the one that doesn't and I can't find a difference.

Can anyone tell me what the problem is?

Thanks

Roger

eny

  • Hero Member
  • *****
  • Posts: 1648
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #1 on: February 20, 2011, 12:29:38 pm »
Are both forms auto-created? (Project Options/Forms)
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

Roger king

  • New Member
  • *
  • Posts: 23
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #2 on: February 20, 2011, 01:27:42 pm »
Hello Eny. Thanks for replying.

Yes. Here is my initialisation file:

program Members_03;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, DBFLaz, LResources, Members03, Filter3, PsWord_01, Data1;

{$IFDEF WINDOWS}{$R Members_03.rc}{$ENDIF}

begin
  {$I Members_03.lrs}
  Application.Initialize;
  Application.CreateForm(TFrm_Members, Frm_Members);
  Application.CreateForm(TFrm_Find, Frm_Find);
  Application.CreateForm(TFrm_PsWord, Frm_PsWord);
  Application.CreateForm(TFrm_Data, Frm_Data);
  Application.Run;
end.

This is my call to open form Frm_Find:

procedure TFrm_Members.BitBtnFindClick(Sender: TObject);
begin
    Frm_Find.ShowModal;
    Dbf1.Filtered := True;
    S0 := S1 + S2 + S3 + S4 + S5;
    Dbf1.Filter := S0;
end;

This works.

This is my call to open form Frm_Data:

procedure TFrm_Members.BitBtnEditClick(Sender: TObject);
begin
  If (Frm_Data.showModal) = mrCancel then exit;
  dbf1.Readonly := false;
  dbf1.edit;
  dbf1.Setfields([Frst, Last, Stat, Posn, Hous, Numb, Road, Area, City, Cont,
                  Code, Phon, Mobl, Emal, Badg]);
  dbf1.post;
  dbf1.Readonly := true;
//  New := True;
end;

This fails.

I tried removing the if part, just using showmodal, as in the Frm_Find call, but it didn't make any difference.

Regards

Roger

eny

  • Hero Member
  • *****
  • Posts: 1648
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #3 on: February 20, 2011, 02:36:45 pm »
procedure TFrm_Members.BitBtnEditClick(Sender: TObject);
begin
  If (Frm_Data.showModal) = mrCancel then exit;
  dbf1.Readonly := false;
  dbf1.edit;
  dbf1.Setfields([Frst, Last, Stat, Posn, Hous, Numb, Road, Area, City, Cont,
                  Code, Phon, Mobl, Emal, Badg]);
  dbf1.post;
  dbf1.Readonly := true;
//  New := True;
end;

This fails.
if 'Frm_Data.showModal' raises the error then I'd say there is something wrong with that form.
Anything special going on on that form?
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

Roger king

  • New Member
  • *
  • Posts: 23
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #4 on: February 20, 2011, 03:39:44 pm »
Hi again, Eny.

The form contains DbEdits,connected to the datasource in the main form. The OnChange action for each sets a boolean, Changed, to true.

When the Done button is pressed, if Changed is true, the ModalResult = mrOK, otherwise = mrCancel.

I will try removing the DbEdits.

Thanks for your help.

Regards

Roger

Roger king

  • New Member
  • *
  • Posts: 23
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #5 on: February 20, 2011, 03:50:12 pm »
I tried removing all controls from the form. exept for the button. It still failed.

Here is the code for the form:
unit Data1;

{$MODE Delphi}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, DbCtrls;

type

  { TFrm_Data }

  TFrm_Data = class(TForm)
    BtnDone: TButton;
    DbEdtArea: TDBEdit;
    DbEdtBadge: TDBEdit;
    DbEdtCity: TDBEdit;
    DbEdtCode: TDBEdit;
    DbEdtCounty: TDBEdit;
    DbEdtEmail: TDBEdit;
    DbEdtFirst: TDBEdit;
    DbEdtHouse: TDBEdit;
    DbEdtLast: TDBEdit;
    DbEdtMobile: TDBEdit;
    DbEdtNumber: TDBEdit;
    DbEdtPhone: TDBEdit;
    DbEdtPosition: TDBEdit;
    DbEdtRoad: TDBEdit;
    DbEdtStatus: TDBEdit;
    LbLArea: TLabel;
    LbLBadg: TLabel;
    LbLCity: TLabel;
    LbLCode: TLabel;
    LbLCont: TLabel;
    LblEMail: TLabel;
    LblFirst: TLabel;
    LbLHous: TLabel;
    LbLMobl: TLabel;
    LbLNumb: TLabel;
    LbLPhon: TLabel;
    LbLPosition: TLabel;
    LbLRoad: TLabel;
    LbLStatus: TLabel;
    LbLSurnamel: TLabel;
    procedure BtnDoneClick(Sender: TObject);
    procedure DbEdtChange(Sender: TObject);
    procedure FormShow(Sender: TObject);

  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Frm_Data: TFrm_Data;
  Change: Boolean;

implementation
Uses Members03;

{ TFrm_Data }

procedure TFrm_Data.BtnDoneClick(Sender: TObject);
begin
  If Change then ModalResult := mrOK else ModalResult := mrCancel;
end;

procedure TFrm_Data.DbEdtChange(Sender: TObject);
begin
  Change := True;
end;

procedure TFrm_Data.FormShow(Sender: TObject);
begin
  Change := false;
end;

initialization
  {$I data1.lrs}
end.

Could it be the {$MODE Delphi}?

Regards

Roger

eny

  • Hero Member
  • *****
  • Posts: 1648
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #6 on: February 20, 2011, 03:59:43 pm »
This looks very trivial; can't see anything strange there.
Although all of your db components are still present in the form's type declaration.
Try removing them as well.

Could it be the {$MODE Delphi}?

I never use the Delphi mode.
Have you tried changing it to 'objfpc'?
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

Roger king

  • New Member
  • *
  • Posts: 23
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #7 on: February 20, 2011, 06:14:39 pm »
Hello again.

The above listing was the original form before I removed the DbEdits.

I am running the application from files on a USB stick. Could it be a communications error.

I have run a similar application on the D drive without a problem. That's why I can't understand why this application fails.

I will try replacing the Delphi.

Regards
Roger

jshand2010

  • Full Member
  • ***
  • Posts: 236
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #8 on: February 20, 2011, 10:10:17 pm »
hi there

your init file is fine.  leave it as is.

in this example i will use simple form 1 and form 2

1.  make sure you know which is your main form.
2.  from the main form you need to ad to the uses area the name of your pascal file that is used by the form you wish to showmodal.  ie uses pform1;  However, this will not go to the top where the other uses are, but just before your own procedures.
3.  Load form1 like this....  form1.ShowModal;
4.  To Close Form1, use the onclose procedure and type in form1.Close;  Hide will not work

If you have any questions, just write me back
OpenSUSE Tumbleweed x86_64, Lazarus 2.2.0RC2 fixes branch, fpc 3.2.3 fixes branch

Roger king

  • New Member
  • *
  • Posts: 23
Re: Showmodal produces: Project raised exception class 'External: SIGSEGV'
« Reply #9 on: February 24, 2011, 10:34:54 pm »
I don't know how, but I have lost the SIGSEGV message.

I suspect that it was something to do with the location of the forms. I resaved the  project in a new directory and Lazarus seems to look back to the old directory, instead of the current one. Is this possible? In Delphi, if I use a file from a remote directory, the file path is shown in the .dpr file, but I am not sure Lazarus does this, so I don't know which file is being used.

Thanks everybody for your help.

Roger

 

TinyPortal © 2005-2018