Recent

Author Topic: Lazarus Release 2.2.0  (Read 18127 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7684
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release 2.2.0
« Reply #60 on: January 12, 2022, 08:22:03 pm »
With this code no more problem :
Code: Pascal  [Select][+][-]
  1. procedure TDosCommand.Stop;
  2. begin
  3.   if (FThread <> nil) then
  4.   begin
  5.     FThread.FreeOnTerminate := true;
  6.     If not FThread.Finished then  FThread.Terminate; //terminate the process
  7.     FThread := nil;
  8.   end;
  9. end;

Actually: "No problem that you have spotted yet.

The code has a race condition. So there is a problem.

Code: Pascal  [Select][+][-]
  1.     FThread.FreeOnTerminate := true;
After that line, when the thread does end, it will free the TThread object. That is the object to which FThread points.

So, from this point on, FThread should be treated as a "dangling pointer". Because it can change into that, at any point.

Of course, if you could guarantee that the thread can not finish.... But since you check in the next line, if it has finished, clearly you can not guarantee this.

Code: Pascal  [Select][+][-]
  1.     If not FThread.Finished then  FThread.Terminate; //terminate the process

So you call "Finished", but the object (pointed to by FThread), may already have been destroyed. The result may be random, or the call may even crash.

And even, if the call is made on a still existing object, that is no good, because the object can be freed between the return from "Finished" and the access to "Terminate". Same dangling pointer issue here.


And mind "FThread <> nil" does not help either. After all a dangling pointer is a non-nil value.
And even if the thread would set FThread to nil, before destroying the object. Still a race condition. Still could happen between your check, and the "then" action that requires the check....
 

Gald

  • Jr. Member
  • **
  • Posts: 78
Re: Lazarus Release 2.2.0
« Reply #61 on: January 13, 2022, 06:53:08 pm »
It looks like I'm the only one with this trouble.

Project > New Project > Run > Image related.
It can't run my old projects too. I can't run anything.

I've updated it from Lazarus 2.0.12.
What did I do wrong?
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

dsiders

  • Hero Member
  • *****
  • Posts: 561
Re: Lazarus Release 2.2.0
« Reply #62 on: January 13, 2022, 07:17:44 pm »
It looks like I'm the only one with this trouble.

Project > New Project > Run > Image related.
It can't run my old projects too. I can't run anything.

I've updated it from Lazarus 2.0.12.
What did I do wrong?

The Note messages are telling you that you have duplicate code in components/freetype and components/lazutils. FreeType was moved into its own package in 2.2.0. https://wiki.lazarus.freepascal.org/Lazarus_2.2.0_release_notes#LazFreeType

I don't know how you updated from 2.0.12 to 2.2.0... but it has remnants of the old version.
Lazarus 2.0.12, 2.2.0, 2.3.0 (Git) / FPC 3.2.0, 3.2.2 / x86 64-bit / Windows 8.1

jonyrh

  • New member
  • *
  • Posts: 6
Re: Lazarus Release 2.2.0
« Reply #63 on: January 14, 2022, 05:00:07 am »
Thank you all for your hard work, I really like Lazarus!  ::)

Sieben

  • Sr. Member
  • ****
  • Posts: 256
Re: Lazarus Release 2.2.0
« Reply #64 on: January 15, 2022, 06:14:47 pm »
'Change Class' not working in 2.2.0...? Whatever I choose, it just doesn't do anything - no errors, just nothing. Any setting I am missing...?
Lazarus 2.0.10, FPC 3.2.0, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

wp

  • Hero Member
  • *****
  • Posts: 9157
Re: Lazarus Release 2.2.0
« Reply #65 on: January 15, 2022, 06:39:32 pm »
'Change Class' not working in 2.2.0...? Whatever I choose, it just doesn't do anything - no errors, just nothing. Any setting I am missing...?
Cannot confirm with Windows 11 and out-of-the-box settings.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Sieben

  • Sr. Member
  • ****
  • Posts: 256
Re: Lazarus Release 2.2.0
« Reply #66 on: January 15, 2022, 07:07:16 pm »
Just tried again with a fresh project and a fresh form and it works... as this doesn't seem to be related to 2.2.0 anymore I moved this to a new topic. Sorry for any inconvenience.
« Last Edit: January 15, 2022, 07:43:05 pm by Sieben »
Lazarus 2.0.10, FPC 3.2.0, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

 

TinyPortal © 2005-2018