Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-12

Old Lazarus code fail at runtime

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Chavoux Luyt

Hi,

I wrote a small program for Linux in a previous version of Lazarus which compiled and ran without problems before. I have now updated to fpc 3.0.0 and Lazarus 1.6 (backports version for Debian X86_64 Jessie). The code still compiles perfectly (it had a number of warnings, but these have now disappeared: e.g. unixfileutil.inc(6,51) Warning: Symbol "UTF8ToSys" is deprecated: "Use the function in LazUTF8 unit"), but it results in a runtime error
"Project birds raised exception class 'External: SIGFPE'.

At address 7FFFEF8FC57F"

when running the following code:
procedure THoofVrm.OpenBtnClick(Sender: TObject);
begin
  OpenDlg.Execute;
end;

What is wrong with my code (and how should I change it)?

I know that there has been a change in FPC/Lazarus string implementation, but this is just a standard Lazarus File Open dialog (TOpenDialog) and result in the error before even allowing me to select the file to open.

I am not using either UTF8ToSys or even the unixfileutil unit AFAICT: "uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, IpHtml, StdCtrls, ExtCtrls, Buttons, ExtDlgs, AsyncProcess, Ipfilebroker, strutils, Soek;"

Any pointers appreciated...

Regards,
Chavoux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161227/5dc6100b/attachment.html>

Reply by email

Giuliano Colla
to Chavoux Luyt

Il 27/12/2016 12:26, Chavoux Luyt via Lazarus ha scritto:

Show quoted text 39 lines
Hi, I wrote a small program for Linux in a previous version of Lazarus which compiled and ran without problems before. I have now updated to fpc 3.0.0 and Lazarus 1.6 (backports version for Debian X86_64 Jessie). The code still compiles perfectly (it had a number of warnings, but these have now disappeared: e.g. unixfileutil.inc(6,51) Warning: Symbol "UTF8ToSys" is deprecated: "Use the function in LazUTF8 unit"), but it results in a runtime error "Project birds raised exception class 'External: SIGFPE'. At address 7FFFEF8FC57F" when running the following code: procedure THoofVrm.OpenBtnClick(Sender: TObject); begin OpenDlg.Execute; end; What is wrong with my code (and how should I change it)? I know that there has been a change in FPC/Lazarus string implementation, but this is just a standard Lazarus File Open dialog (TOpenDialog) and result in the error before even allowing me to select the file to open. I am not using either UTF8ToSys or even the unixfileutil unit AFAICT: "uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, IpHtml, StdCtrls, ExtCtrls, Buttons, ExtDlgs, AsyncProcess, Ipfilebroker, strutils, Soek;" Any pointers appreciated... Regards, Chavoux

Just a wild guess. The villain might be some property (such as FileName, Filter or InitialDir) that you did set up with old Lazarus at design time and which isn't compatible with current version. Revising the design time properties of your File Open Dialog with Object Inspector should fix the issue.
Giuliano

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161227/8e7b33bf/attachment.html>

Reply by email

DougC
to Giuliano Colla

Has OpenDialog been created at this point? Better to double check by changing to

if Assigned(OpenDialog) then
  OpenDialog.Execute

else

  raise Exception.Create('OpenDialog not yet created');

---- On Tue, 27 Dec 2016 16:00:19 -0500 Giuliano Colla via Lazarus &lt;&gt; wrote ----

Il 27/12/2016 12:26, Chavoux Luyt via Lazarus ha scritto:

Hi,

I wrote a small program for Linux in a previous version of Lazarus which compiled and ran without problems before. I have now updated to fpc 3.0.0 and Lazarus 1.6 (backports version for Debian X86_64 Jessie). The code still compiles perfectly (it had a number of warnings, but these have now disappeared: e.g. unixfileutil.inc(6,51) Warning: Symbol "UTF8ToSys" is deprecated: "Use the function in LazUTF8 unit"), but it results in a runtime error

"Project birds raised exception class 'External: SIGFPE'.

At address 7FFFEF8FC57F"

when running the following code:

procedure THoofVrm.OpenBtnClick(Sender: TObject);
begin
  OpenDlg.Execute;
end;

What is wrong with my code (and how should I change it)?

I know that there has been a change in FPC/Lazarus string implementation, but this is just a standard Lazarus File Open dialog (TOpenDialog) and result in the error before even allowing me to select the file to open.

I am not using either UTF8ToSys or even the unixfileutil unit AFAICT:

"uses

Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,

IpHtml, StdCtrls, ExtCtrls, Buttons, ExtDlgs, AsyncProcess, Ipfilebroker,

strutils, Soek;"

Any pointers appreciated...

Regards,

Chavoux

Just a wild guess. The villain might be some property (such as FileName, Filter or InitialDir) that you did set up with old Lazarus at design time and which isn't compatible with current version. Revising the design time properties of your File Open Dialog with Object Inspector should fix the issue.

Giuliano

Reply by email

José Mejuto
to Chavoux Luyt: I wrote a small program for Linux in a previous version of Lazarus which compiled and ran…
Chavoux Luyt wrote 21 lines
Hi, I wrote a small program for Linux in a previous version of Lazarus which compiled and ran without problems before. I have now updated to fpc 3.0.0 and Lazarus 1.6 (backports version for Debian X86_64 Jessie). The code still compiles perfectly (it had a number of warnings, but these have now disappeared: e.g. unixfileutil.inc(6,51) Warning: Symbol "UTF8ToSys" is deprecated: "Use the function in LazUTF8 unit"), but it results in a runtime error "Project birds raised exception class 'External: SIGFPE'. At address 7FFFEF8FC57F" when running the following code: procedure THoofVrm.OpenBtnClick(Sender: TObject); begin OpenDlg.Execute; end; What is wrong with my code (and how should I change it)?

Hello,

Probably nothing wrong by your side, try to disable math exceptions before the call to .execute and reenable after it (C code does not trap math exceptions).

uses math;
var
   oldexcept: TFPUExceptionMask;
oldexcept := SetExceptionMask([exInvalidOp, exDenormalized,
exZeroDivide, exOverflow, exUnderflow, exPrecision]);
OpenDlg.execute;
SetExceptionMask(oldexcept);

Reply by email

Chavoux Luyt

Hi,

From: Giuliano Colla

Show quoted text 7 lines
Just a wild guess. The villain might be some property (such as FileName, Filter or InitialDir) that you did set up with old Lazarus at design time and which isn't compatible with current version. Revising the design time properties of your File Open Dialog with Object Inspector should fix the issue. Giuliano

How do I do this? I created a new TOpenDialog (should be new version now?) with the same name and the same InitialDir property set as "./data/text". Still the same error (also when using the TOpenPictureDialog with InitialDir set to "./data/photo"). However, just opening the file itself using

Show quoted text 11 lines
brdNr := StrToInt(NumberStr); brdNr := brdNr + 1; NumberStr := AddChar('0', IntToStr(brdNr), 3); FileNm := 'file://' + BaseDir + '/text/' + NumberStr + '.htm'; Self.IpHtmlPanel1.OpenURL(fileNm); AND FileNm := BaseDir + '/photo/' + NumberStr + 'a.jpg'; Image.Picture.LoadFromFile(fileNm); FileNm := BaseDir + '/plate_bd/' + NumberStr + 'a.png'; ImageDraw.Picture.LoadFromFile(fileNm);

it works without problems.
<SNIP>

Show quoted text 15 lines
From: DougC Has OpenDialog been created at this point? Better to double check by changing to if Assigned(OpenDialog) then OpenDialog.Execute else raise Exception.Create('OpenDialog not yet created'); Yes, has it has been created. Adding the check has no use the following code elsewhere (but only after executing and closing

the OpenDialog:

Show quoted text 5 lines
NumberStr := AnsiLeftStr(NumberStr, RPos('.', NumberStr)-1); NumberStr := AnsiRightStr(NumberStr, 3);//RPos('/', NumberStr)); Can this have an influence on the OpenDialog?

Any other ideas?

Cheers,
Chavoux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161229/1c47759e/attachment.html>

Reply by email