Welcome, Guest
Username: Password: Remember me
CodeTyphon Linux OS Development, discussions and problems
  • Page:
  • 1

TOPIC:

Application crash on creating new thread x86 / x64 7 years 6 months ago #10778

  • VCC
  • VCC's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
Hi,
I hope I'm posting into the right place. I've recently found out that creating a thread under Linux, either x86 or x64, crashes the application. Although this is not the first time I create multi threaded applications for Linux, it is the first time the application does not use Indy. As far as I can see, linking Indy package to the application, does something that prevents the crash.
So, the example thread is simple, like:
type
  TMyThread = class(TThread)
  protected
    procedure Execute; override;
  end;
and I create a new instance from a button:
procedure TfrmCrashOnCreatingThreadMain.btnCreateThreadClick(Sender: TObject);
begin
  AThread := TMyThread.Create(True);
  AThread.Start;
end;
The application crashes on the "TMyThread.Create" line. When debugging the crash, the debugger points to some exotic assembly code, so I can't provide more details about what is happening.
I had an old installation of CT5.8 and now I have one of 6.15. Both versions produced a code which crashes. I don't know how far goes this, because I could test only these two versions. It reproduces on kubuntu 16.04 (64-bit OS), both with 64-bit and 32-bit builds of the application (see attached). It reproduces, both on virtual machines and on physical machines. I don't have at the moment other distributions to test on.
A workaround to avoid the crash is to add pl_indy package to the application, with project inspector. I don't know what stuff Indy brings, but the application does not crash anymore (neither the 32-bit nor the 64-bit builds).
If it matters, CT was installed with its default settings (with multiarchitecture mode).

Thank you.

Please Log in or Create an account to join the conversation.

Application crash on creating new thread x86 / x64 7 years 6 months ago #10779

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Thanks Sir
Did you use cthreads in your app
{$DEFINE UseCThreads}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Application crash on creating new thread x86 / x64 7 years 6 months ago #10781

  • VCC
  • VCC's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
Hi,
the application had no UseCThreads directive defined. After adding it, all is ok. Now it makes sense.
Thank you again. :)

Please Log in or Create an account to join the conversation.

Application crash on creating new thread x86 / x64 7 years 6 months ago #10784

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Have fun...
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1