Skip to content
GitLab
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • FPC
  • Lazarus Lazarus
  • LazarusLazarus
  • Issues
  • #9597

Application crash when creating a thread in FreeBSD

Original Reporter info from Mantis: papelhigienico
  • Reporter name: Fabio Luis Girardi

Description:

In my application, i'm creating a thread (using TThread class). When my application call the thread constructor, it crash!

Steps to reproduce:

Create a simple thread in freebsd, source are in additional information

Additional information:

Error when creating thread on FreeBSD 6.1 with Lazarus 0.9.23 and FPC 2.0.4

Error Description: "Project raised exception class 'RunError(232)'"

Dialog: Execution Paused
        Address : $0806cd80
        Procedure: SYSTEM_NOTHREADERROR
        File:

Dialog: Execution Stopped

---------------------------------------------------------------------
---------------------------------------------------------------------
Unit1.pas - Form1
---------------------------------------------------------------------
---------------------------------------------------------------------

unit unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, unit2;

type

{ TForm1 }

  TForm1 = class(TForm)
    HMICheckBox1: THMICheckBox;
    HMIEdit1: THMIEdit;
    HMIEdit2: THMIEdit;
    HMILabel1: THMILabel;
    HMIRadioButton1: THMIRadioButton;
    procedure FormCreate(Sender: TObject);
  private
    teste:TMyTestThread;
  public

  end; 

var
  Form1: TForm1; 

implementation

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  teste:=TMyTestThread.Create(false);
end;

initialization
  {$I unit1.lrs}

end.
---------------------------------------------------------------------
---------------------------------------------------------------------
Unit2.pas - Thread
---------------------------------------------------------------------
---------------------------------------------------------------------
unit Unit2; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils;

type
  TMyTestThread = class(TThread)
  private
    x:Integer;
    procedure ChangeCaption;
  protected
    procedure Execute; override;
  end;

implementation

uses unit1;

procedure TMyTestThread.ChangeCaption;
begin
  Form1.Caption := IntToStr(x);
end;

procedure TMyTestThread.Execute;
begin
  while not Terminated do begin
    inc(x);
    Synchronize(@ChangeCaption);
  end;
end;

end.

Mantis conversion info:

  • Mantis ID: 9597
  • OS: FreeBSD
  • OS Build: 6.1
  • Platform: i386
  • Monitored by: » thierrybo (thierrybo), » lucky62 (lucky62)
Assignee
Assign to
Time tracking