Recent

Author Topic: How to terminate the thread correctly?  (Read 8575 times)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: How to terminate the thread correctly?
« Reply #15 on: August 14, 2018, 04:46:06 pm »


You do know that FThread.Free does check that FThread is not nil,
to late, if the FThread is nill calling free should raise a GPF exception, there is no way to allow your app to access address 0.
Why? It simply calls TObject.Free:
Code: Pascal  [Select][+][-]
  1.  procedure TObject.Free;
  2.  begin // the call via self avoids a warning
  3.     if self <> nil then self.destroy;
  4. end;
  5.  


if the FThread is nill calling free should raise a GPF exception, there is no way to allow your app to access address 0.
TObject(nil).Free;  ;)

I know how it works I'm just demonstrating my debugging logic, it has helped me a lot to avoid pitfalls. Keep on doing your thing and I'll stick to mine.
« Last Edit: August 14, 2018, 04:48:10 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018