Jump to content

David Hoyle

Members
  • Content Count

    184
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by David Hoyle


  1. 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.


  2. 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) 🙂


  3. 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.


  4. 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;

     


  5. 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 :classic_biggrin:

    • Like 1

  6. 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.

    image.thumb.png.be1faab54b94de576a9c66fba01102cf.png

    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
    
    

     


  7. 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).

    image.png.548cc77402efc7571de442398702cf89.png

    image.png.812285bb263d6c327441160382d98f98.png

    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).

    • Like 1

  8. 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.

    • Thanks 1
×