-
Content Count
39 -
Joined
-
Last visited
Everything posted by zed
-
There are Delphi wrappers for libcurl (for example: mormot2), so you can easily port your existing C code to Delphi.
-
Start of the next day is the end of the current day, so you can write: var a, b: TDateTime; begin a := StrToDateTime('17:30'); b := StrToDateTime('00:00') + 1; // 24:00 WriteLn(MinutesBetween(b, a)); // 390
-
In Delphi 11 they changes default font to "Segoe UI".
-
Made QP of replacing Delphi ZLib implementation with faster one.
zed replied to Tommi Prami's topic in RTL and Delphi Object Pascal
My wrapper: https://github.com/zedxxx/libdeflate-pas -
Hextor - Hexadecimal editor and binary data analyzing toolkit
zed replied to DigitalWolF's topic in I made this
Good work! -
Delphi 11.1 also changes the Form font size: - PixelsPerInch = 96 - TextHeight = 13 + TextHeight = 15
-
Delphi 11 Windows XP compatibility tweak
zed replied to mitzi's topic in RTL and Delphi Object Pascal
A change in TThread breaks Windows XP compatibility -
@vfbb How about using a lock? Try this fix: diff --git a/Unit1.pas b/Unit1.pas index e0d57a2..a27eef0 100644 --- a/Unit1.pas +++ b/Unit1.pas @@ -6,7 +6,7 @@ interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Threading, - FMX.Controls.Presentation, FMX.StdCtrls; + FMX.Controls.Presentation, FMX.StdCtrls, System.SyncObjs; type ITest = interface @@ -38,6 +38,7 @@ type FThreadsPool: TArray<TThreadPool>; FTest: ITest; FTestWeak: TArray<TWeakOfTest>; + FLock: TCriticalSection; public { Public declarations } end; @@ -54,6 +55,7 @@ implementation procedure TForm1.FormCreate(Sender: TObject); begin + FLock := TCriticalSection.Create; FTestControlThreadPool := TThreadPool.Create; FTestControlTask := TTask.Run( procedure() @@ -85,17 +87,32 @@ begin begin while (not FDestroying) and (not FCanceled) do begin - LTest := Form1.FTestWeak[(Length(Form1.FTestWeak) div 2)-1].FTestWeak; // Use a weak reference that is in the middle of the list of weak references + FLock.Acquire; + try + LTest := Form1.FTestWeak[(Length(Form1.FTestWeak) div 2)-1].FTestWeak; // Use a weak reference that is in the middle of the list of weak references + finally + FLock.Release; + end; if Assigned(LTest) then // Test if the strong reference is valid, that is, theoretically verify that the object has not yet been destroyed begin LTest.Test; // Just a useless call, because if the reference still exists and the object has been destroyed, this will give an exception - LTest := nil; // Removing the strong reference + FLock.Acquire; + try + LTest := nil; // Removing the strong reference + finally + FLock.Release; + end; end; end; end, Form1.FThreadsPool[I]); end; Sleep((Random(20) + 3) * 500); // Wait all tasks run many AddRef / Release simulating a stress test - Form1.FTest := nil; // Remove the strong ref to force the object destruction (Note: we don't know what task will destroy, will be the last that remove the strong ref) + FLock.Acquire; + try + Form1.FTest := nil; // Remove the strong ref to force the object destruction (Note: we don't know what task will destroy, will be the last that remove the strong ref) + finally + FLock.Release; + end; Sleep((Random(10) + 1) * 200); // Wait some seconds to ensure the object destruction // Cancel the test, check if have error, free all objects and get ready to repeat the next test loop @@ -137,6 +154,7 @@ begin FTestControlTask.Wait; FTestControlTask := nil; FTestControlThreadPool.Free; + FLock.Free; end; { TTest } To protect your data you need to use a lock every time you assign value to the LTest and Form1.FTest.
-
@Oberon82 I have just been informed that the problem has been fixed and you can request the key as usual: https://www.embarcadero.com/products/delphi/starter/free-download/
-
And how do you propose to get a new license?
-
License extension is broken at the moment. I have reported the problem to Embarcadero (thanks Cathy Hundley), so it remains to wait while they fix the bug. By the way, exactly the same problem with license extending was a year ago...