-
Content Count
186 -
Joined
-
Last visited
-
Days Won
2
Everything posted by David Hoyle
-
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.
-
IComparer Interface not being released
David Hoyle replied to David Hoyle's topic in RTL and Delphi Object Pascal
Thank you @David Heffernan and @Dalija Prasnikar. -
IComparer Interface not being released
David Hoyle replied to David Hoyle's topic in RTL and Delphi Object Pascal
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. -
IComparer Interface not being released
David Hoyle replied to David Hoyle's topic in RTL and Delphi Object Pascal
Ignore me, should have checked QP first: https://quality.embarcadero.com/browse/RSP-15797. -
Moving existing menu items between popup menus?
David Hoyle replied to Incus J's topic in Delphi IDE and APIs
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. -
@Dave Nottage see my response above, I was having a very dense day yesterday.
-
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) 🙂
-
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.
-
@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.
-
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.
-
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;
-
IDE extension to fade inactive {$IFDEF} {$ELSE} {$ENDIF} block
David Hoyle replied to Clément's topic in Delphi IDE and APIs
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 -
IDE extension to fade inactive {$IFDEF} {$ELSE} {$ENDIF} block
David Hoyle replied to Clément's topic in Delphi IDE and APIs
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. -
ANN: Documentation Insight Hotfix for Delphi 10.3.2
David Hoyle replied to baoquan.zuo's topic in Delphi Third-Party
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. -
Thomas, Unfortunately, it would seem something has changed in RAD Studio which is now crashing GExperts. The following appear when you shutdown the IDE (whether its immediately after opening or after a time of working). I know its GExperts as I've removed all experts and added them back one at a time until the last one to be added was GExperts (as I suspected it might be - only because its likely to be one of the few experts that will work outside of the OTA). I've tried to get more information by changing EurekaLog's IDE settings to capture all errors but it would seem they are happening after the EL BPL had unloaded. If you need more information, please ask and I'll debug the IDE with the IDE (although I don't have the GExperts source).
-
GExperts 1.3.13.77 Crashes RAD Studio 10.3.2 on Shutdown
David Hoyle replied to David Hoyle's topic in GExperts
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 -
@dummzeuchIt might be something to do with most if not all the Embarcadero servers not working properly and 10.3.2 cannot authenticate you current license.
-
GExperts 1.3.13.77 Crashes RAD Studio 10.3.2 on Shutdown
David Hoyle replied to David Hoyle's topic in GExperts
@timfrost I'll investigate removing other packages (some my own other not) until GExperts stops crashing. I'll even try debugging the crash to see what is causing it. -
Which brings us back to another conversation... I will not comment on
-
@Markus KinzlerSometimes a refresh doesn't work and you need to remove and re-add the license to get the updated permissions.
-
ANN: Documentation Insight Hotfix for Delphi 10.3.2
David Hoyle replied to baoquan.zuo's topic in Delphi Third-Party
Slight problem with the about dialogue (on a large screen 2560 x 1440 @ 100% scaling)... i.e. I can't read it 😞 -
GExperts 1.3.13.77 Crashes RAD Studio 10.3.2 on Shutdown
David Hoyle replied to David Hoyle's topic in GExperts
Thomas, I originally has 1.3.12.76 but before reporting the issue updated to 1.3.13.77 from your website (so the installer version not my own). -
keyboard shortcut for activating the code editor
David Hoyle replied to dummzeuch's topic in GExperts
@dummzeuch I don't think there is as I implemented a shortcut of my own in Browse and Doc It a long time ago (I use CTRL+SHIFT+ALT+<Enter> as the default). -
Why control methods (OnClick) can't be defined in Form Private section?
David Hoyle replied to Mike Torrettinni's topic in VCL
I was trying to find an updated reference for this but it goes something like this... TComponent and all its derivatives (components on forms) are designed to be loaded and save to the DFM files, in binary format or text. The IDE uses this when you visually design a form and places all event handlers and component references in the top of a class which is a published scope. These contain RTTI information for the loading and saving mechanisms. When you run your application the same streaming mechanisms are used to load your forms from the DFM which are resources within your EXE. If you've moved the declarations to another scope other than published then they cannot be loaded either by the IDE or by your application at run-time. -
Why control methods (OnClick) can't be defined in Form Private section?
David Hoyle replied to Mike Torrettinni's topic in VCL
All IDE managed components on a form and their event handlers must be published as this is the mechanism the IDE uses to load and save the form layout and event handler.