Jump to content

David Hoyle

Members
  • Content Count

    85
  • Joined

  • Last visited

  • Days Won

    1

David Hoyle last won the day on February 5

David Hoyle had the most liked content!

Community Reputation

36 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. David Hoyle

    IComparer Interface not being released

    Thank you @David Heffernan and @Dalija Prasnikar.
  2. David Hoyle

    IComparer Interface not being released

    Thank's Stefan. Originally I had the following... System.Generics.Collections.TArray.Sort<TXTColumnPosition>(Result, TXTColumnPositionComparer.Create); and that would release. I changed it while trying to find out why. I'll change it as you suggest (I should have noticed that) and see if it works.
  3. David Hoyle

    IComparer Interface not being released

    Ignore me, should have checked QP first: https://quality.embarcadero.com/browse/RSP-15797.
  4. I wonder if anyone can either confirm I'm not going insane and this is a bug I need to report or tell me what I'm doing wrong. Eurekalog has found a bug in my application and I've managed to decant it down to the following code - it takes a pair of integers and sorts them by the FPosition field (code to get the display order of a VirtualStringTree). The commented out line in Test() should not be required in my mind as the IComparer interface should be released when it goes out of scope at the end of the Test() function but it doesn't for me (I'm using 10.3.2). Program ComparerFreeing; {$APPTYPE CONSOLE} {$R *.res} Uses System.SysUtils, System.Generics.Collections, System.Generics.Defaults; Type TXTColumnPosition = Record FIndex, FPosition : Integer; End; TXTColumnPositionComparer = Class(TInterfacedObject, IComparer<TXTColumnPosition>) Public Constructor Create; Destructor Destroy; Override; Function Compare(Const Left, Right : TXTColumnPosition) : Integer; End; Function TXTColumnPositionComparer.Compare(Const Left, Right: TXTColumnPosition): Integer; Begin Result := Left.FPosition - Right.FPosition; End; Constructor TXTColumnPositionComparer.Create; Begin WriteLn('Create'); Inherited; End; Destructor TXTColumnPositionComparer.Destroy; Begin WriteLn('Destroy'); Inherited; End; Function Test : TArray<TXTColumnPosition>; Var Comparer: TXTColumnPositionComparer; Begin SetLength(Result, 5); // Result[0].FIndex := 0; // Result[0].FPosition := 4; // Result[1].FIndex := 1; // Result[1].FPosition := 3; // Result[2].FIndex := 2; // Dummy setup for testing Result[2].FPosition := 2; // Result[3].FIndex := 3; // Result[3].FPosition := 1; // Result[4].FIndex := 5; // Result[4].FPosition := 0; // Comparer := TXTColumnPositionComparer.Create; System.Generics.Collections.TArray.Sort<TXTColumnPosition>(Result, Comparer); //: @debug Comparer.DisposeOf; // Required to release the interface End; Var aInts : TArray<TXTColumnPosition>; i : Integer; Begin Try aInts := Test; For i := Low(aInts) To High(aInts) Do WriteLn(aInts[i].FIndex, ' => ', aInts[i].FPosition); ReadLn; Except On E: Exception Do Writeln(E.ClassName, ': ', E.Message); End; End. I get the following output from the above... Create 5 => 0 3 => 1 2 => 2 1 => 3 0 => 4 i.e. Destroy is not called.
  5. If dragging and dropping in the structures pain does not work I would view the form as text Alt+F12 in my keybindings and move the items in the DFM. If you are not familiar with the DFM format please backup the file first.
  6. David Hoyle

    Resolve a uses clause unit path?

    @Dave Nottage see my response above, I was having a very dense day yesterday.
  7. David Hoyle

    Resolve a uses clause unit path?

    Couldn't see the wood for the trees yesterday... If Supports(Project.ProjectOptions, IOTAProjectOptionsConfigurations, POC) Then Begin strSearchPath := POC.ActiveConfiguration.Value[sUnitSearchPath]; ... End; That's been bugging me all day (pun intended) 🙂
  8. David Hoyle

    Resolve a uses clause unit path?

    No flame was inferred 😀. The point I was trying to make was that Dave suggested using iOTABuildConfiguration with constants. This would not work for me.
  9. David Hoyle

    Resolve a uses clause unit path?

    @Uwe Raabe No I wasn't 😞 Can't remember when environment variables were introduced but I see that start life in XE3. I would have to test whether this works for all environment variables, i.e. %AppData% etc.
  10. David Hoyle

    Resolve a uses clause unit path?

    Actually I disagree, sorry. The IOTABuildConfiguration should be the new way to do thing as its takes account of the various configurations you might want (Debug / Release being the basics). I used IOTAProjectOptions which is the old pre-XE2 IDE style where there was only one option but it does seem to return the active configuration which is what I wanted. I got 4 values out of the active IOTABuildConfiguration but loads of stuff out of the IOTAProjectOptions and I could use any of the constants in DCCStrs or CommonOptionsStrs. BTW: I'm using 10.2.3. I have yet to test this on previous compilers / IDEs.
  11. David Hoyle

    Resolve a uses clause unit path?

    I know I'm a week behind in this conversation but unfortunately the code @Dave Nottage referred to does not work. I've had to do something similar today for an old OTA plug-in in which I never checked for CodeSiteLogging being on the library path. The below code is what I've eventually had to do (`IOTAProjectOptionsConfiguration` would not return any useful information on the project). Class Procedure TDDTOpenToolsAPIFunctions.CheckLibraryPath; ResourceString strCodeSiteLoggingNotFound = '"CodeSiteLogging" not found in your library paths!'; Const strProjectSrcDir = 'SrcDir'; strDCCLibraryPath = 'LibraryPath'; strCodeSiteLoggingDcu = 'CodeSiteLogging.dcu'; Var slSearchLibrary: TStringList; PO: IOTAProjectOptions; S : IOTAServices; BDSMacros: TRegEx; M: TMatch; slMacros: TStringList; iMacro: Integer; Begin slSearchLibrary := TStringList.Create; Try If Supports(ActiveProject.ProjectOptions, IOTAProjectOptions, PO) Then slSearchLibrary.Add(StringReplace(VarToStr(PO.Values[strProjectSrcDir]), ';', #13#10, [rfReplaceAll])); If Supports(BorlandIDEServices, IOTAServices, S) Then slSearchLibrary.Add(StringReplace(VarToStr(S.GetEnvironmentOptions.Values[strDCCLibraryPath]), ';', #13#10, [rfReplaceAll])); slMacros := TStringList.Create; Try BDSMacros := TRegEx.Create('\$\((\w+)\)', [roIgnoreCase, roMultiLine, roCompiled]); For M In BDSMacros.Matches(slSearchLibrary.Text) Do Begin If slMacros.IndexOfName(M.Groups.Item[1].Value) = -1 Then slMacros.AddPair(M.Groups.Item[1].Value, StringReplace( GetEnvironmentVariable(M.Groups.Item[1].Value), '\', '\\', [rfReplaceAll])); End; For iMacro := 0 To slMacros.Count - 1 Do Begin BDSMacros := TRegEx.Create('\$\(' + slMacros.Names[iMacro] + '\)', [roIgnoreCase, roMultiLine, roCompiled]); slSearchLibrary.Text := BDSMacros.Replace(slSearchLibrary.Text, slMacros.ValueFromIndex[iMacro]); End; Finally slMacros.Free; End; If FileSearch(strCodeSiteLoggingDcu, StringReplace(slSearchLibrary.Text, #13#10, ';', [rfReplaceAll])).Length = 0 Then OutputMsg(strCodeSiteLoggingNotFound); Finally slSearchLibrary.Free; End; End;
  12. Having written a few highlights for the IDE for other scripts I know it could in essence be done however the highlighter would need to know more about what it is parsing than just the line of code it currently expects, i.e. what IFDEFs are in play. For those defined in the Project Options not so bad but for those that may be define in code it's more difficult as the highlighter would have to pre-parse the code. This would be a performance issue if not handled in a background thread, i.e. parse some code (assuming the current module only not the project and place a list of active defines in the wizard that the highlighter can use). One other thing would be that the list of colours / fonts the IDE uses is fixed so the colour for the disabled IFDEF section would have to be configurable by the wizard interface. I'll caveat all of the above with - this is just theory
  13. I'm not aware of one. The first thought is a al CnPack and Parnassum and hack the editor and draw of the top of it but on reflection there may be an easier way, you could write an enhanced highlighter for the IDE and use that instead of the built in one.
  14. David Hoyle

    ANN: Documentation Insight Hotfix for Delphi 10.3.2

    Old tired eyes I forked out for 2 last year instead of a new laptop (had to fork out for that 2 months ago when the old one died). I makes a huge difference to the experience of coding.
  15. David Hoyle

    GExperts 1.3.13.77 Crashes RAD Studio 10.3.2 on Shutdown

    I'm well confused now! Below are the Experts being loaded. If GExperts is the last then I get the call stack exceptions also below (from a second clean instance of the IDE) but if I load GExperts earlier in the process (as per the list below) NO crash from the IDE 😕 Note: MMX is not enabled as this was added after I reported the issues yesterday so it disabled to ensure its not MMX. Looks like EurekaLog has a hanging notifier (I'll send this to them for them to have a look at this) and the Parnassus Core Editor has a handing reference. So @dummzeuch you don't need to do anything at the moment but I'm still perplexed that I had a stable IDE and then adding GExpert in suddenly causes the crashes. Exception 1 :208e1367 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :237c2f2b EurekaLogExpert260.@Ecommon@GetCurrentProject$qqrx20System@UnicodeString + 0xc3 :237c1fdf ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b27f ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b46b ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :208e6228 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :208e68db coreide260.@Ideservices@FileNotification$qqr29Toolsapi@TOTAFileNotificationx20System@UnicodeString + 0x17 :0d84d850 Exception 2 :208e1367 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :237c2f2b EurekaLogExpert260.@Ecommon@GetCurrentProject$qqrx20System@UnicodeString + 0xc3 :237c1fdf ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b29c ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b46b ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :208e6228 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :208e68db coreide260.@Ideservices@FileNotification$qqr29Toolsapi@TOTAFileNotificationx20System@UnicodeString + 0x17 :0d84d850 Exception 3 :208e1367 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :237c2f2b EurekaLogExpert260.@Ecommon@GetCurrentProject$qqrx20System@UnicodeString + 0xc3 :237c1fdf ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b27f ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b46b ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :208e6228 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :208e68db coreide260.@Ideservices@FileNotification$qqr29Toolsapi@TOTAFileNotificationx20System@UnicodeString + 0x17 :0d84d850 Exception 4 :208e1367 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :237c2f2b EurekaLogExpert260.@Ecommon@GetCurrentProject$qqrx20System@UnicodeString + 0xc3 :237c1fdf ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b29c ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :2380b46b ; D:\Documents\RAD Studio\Binaries\EurekaLog 7\Packages\Studio26\EurekaLogExpert260.bpl :208e6228 ; C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\coreide260.bpl :208e68db coreide260.@Ideservices@FileNotification$qqr29Toolsapi@TOTAFileNotificationx20System@UnicodeString + 0x17 :0d84d850 Exception 5 RTL.System._IntfClear(???) :500679a8 @IntfClear + $10 :125d2813 ; D:\OneDrive\Documents\Embarcadero\Studio\20.0\CatalogRepository\ParnassusCoreEditor-1.0\ParnassusCoreEditor.dll :125f2c90 ; D:\OneDrive\Documents\Embarcadero\Studio\20.0\CatalogRepository\ParnassusCoreEditor-1.0\ParnassusCoreEditor.dll RTL.System._IntfClear(???) :500679ab @IntfClear + $13 RTL.System.TInterfacedObject._Release RTL.System._IntfClear(???) :500679ab @IntfClear + $13 RTL.System.TObject.Free RTL.System.SysUtils.FreeAndNil(???) :5005f8eb TObject.Free + $B RTL.System._Halt0 :50061935 @Halt0 + $B1 :775f0466 ntdll.RtlFreeUserStack + 0xb6 :775bd40c ntdll.RtlGetNtSystemRoot + 0x6c :775cb044 ntdll.LdrShutdownProcess + 0xf4 :775deed5 ntdll.RtlExitUserProcess + 0xb5 :75364f33 KERNEL32.ExitProcess + 0x13 RTL.System._Halt0 :5006199a @Halt0 + $116 :75360419 KERNEL32.BaseThreadInitThunk + 0x19 :775e662d ntdll.RtlGetAppContainerNamedObjectPath + 0xed :775e65fd ntdll.RtlGetAppContainerNamedObjectPath + 0xbd
×