TPairSplitter control leads to crash lazarus / 31-LCL ---------------------------------------------------------------------- MOSTech6502 · 2024-10-04 02:55 Having an issue with Lazarus 3.6.0, 64-bit Windows build. Steps: * create a new project (application) * add a TPairSplitter from additional controls * try to build and run the app This causes the app to crash on startup, with the message 'Class "TPairSplitterSide" not found." Additionally, trying to double-click one of the TPairSplitterSide entries in the Object Explorer (left panel) gives an IDE error: "Unable to show method. Please fix the error shown in the message window which is normally below the source editor."  Aborting the IDE gives an error message of "Read error: Access violation" twice. Is TPairSplitter broken in the latest release (3.6.0)?  Or maybe I have a bad install, or some other issue? ---------------------------------------------------------------------- Groffy · 2024-10-04 05:46 Hello, I can't confirm the behaviour you desribed. ---------------------------------------------------------------------- dseligo · 2024-10-04 07:58 Quote from: MOSTech6502 on October 04, 2024, 04:55:45 amHaving an issue with Lazarus 3.6.0, 64-bit Windows build. Steps: * create a new project (application) * add a TPairSplitter from additional controls * try to build and run the app This causes the app to crash on startup, with the message 'Class "TPairSplitterSide" not found." Check if you have 'PairSplitter1', 'PairSplitterSide1' and 'PairSplitterSide2' entries between 'TForm1 = class(TForm)' and 'private' in the unit. Did you save project before starting it? I've had similar issues with Lazarus couple of versions back (maybe starting with 3.0, but I'm not sure). It is only with new project and it happens only occasionally. When I add new component to form (this is TButton in most cases, since most new project I create are for some testing, but as I can recall, even non visual components can also make this problem), new entry is not created in TForm1 class, but it is created on form. When I double click on such component I get error (something that ). I usually resolve this so that I save project, delete component from form, add it again and then it all works. And I never have problems with that project again. I just tried to create new project with Lazarus 3.4 (on Windows 11) and I got this problem. I attached screenshots. In screenshot 'problem1' you can see that button is on the form, but it's not under TForm1 class. Screenshot 'problem2' shows when I double clicked on a button. Screenshots 'problem3' and 'problem4' shows when starting program. It would be good idea if you post here complete project that fails. QuoteAdditionally, trying to double-click one of the TPairSplitterSide entries in the Object Explorer (left panel) gives an IDE error: "Unable to show method. Please fix the error shown in the message window which is normally below the source editor."  Aborting the IDE gives an error message of "Read error: Access violation" twice. If the issue is as I described, that is probably connected with it. ---------------------------------------------------------------------- dseligo · 2024-10-04 08:05 OK, I tried with TPairSplitter. I can reproduce it with Lazarus 3.4 (Windows 11) like this: - open existing project, then run and close program - then I create new project - add TPairSplitter (or any other component) - run project I attached screenshots with TPairSplitter. ---------------------------------------------------------------------- wp · 2024-10-04 09:02 Quote from: dseligo on October 04, 2024, 10:05:15 amI can reproduce it with Lazarus 3.4 (Windows 11) like this: - open existing project, then run and close program - then I create new project - add TPairSplitter (or any other component) - run project Cannot reproduce, even with these steps (Laz 3.4 32bit or 64bit, Win 11). Maybe your "existing project" caused it? Does it happen with any existing project? ---------------------------------------------------------------------- dseligo · 2024-10-04 09:41 Quote from: wp on October 04, 2024, 11:02:59 amQuote from: dseligo on October 04, 2024, 10:05:15 amI can reproduce it with Lazarus 3.4 (Windows 11) like this: - open existing project, then run and close program - then I create new project - add TPairSplitter (or any other component) - run project Cannot reproduce, even with these steps (Laz 3.4 32bit or 64bit, Win 11). Maybe your "existing project" caused it? Does it happen with any existing project? No, never with existing project. But it happens only after I ran existing projects (and not every existing project), and then create new project. I'll try to find some minimal project that causes this and then analyze what I use in it. ---------------------------------------------------------------------- wp · 2024-10-04 10:50 QuoteQuote from: dseligo on October 04, 2024, 11:41:55 amMaybe your "existing project" caused it? Does it happen with any existing project? No, never with existing project. But it happens only after I ran existing projects (and not every existing project), and then create new project. Yes, I understood it like you say: run an existing project, then create a new project. But still, having loaded an existing project before creating the new project might have damaged the IDE. ---------------------------------------------------------------------- MOSTech6502 · 2024-10-04 12:56 For me, the issue happens even without loading any existing project first - and I even uninstalled completely the IDE, then reinstalled it, and the first project created has the issue. Possibly it's the opposite case happening: loading an existing project fixes the initialization?  As I am looking at this, it doesn't appear the IDE has generated the necessary "PairSplitterSide" entries in the PairSplitter class setup. In any case, I've attached a .zip with a sample project I created that is crashing. ---------------------------------------------------------------------- wp · 2024-10-04 14:32 Quote from: MOSTech6502 on October 04, 2024, 02:56:25 pmIn any case, I've attached a .zip with a sample project I created that is crashing. Yes, this project is crashing. Because the TPairSplitterSides were not added to the form declaration in the pas file. Just like dseligo described. But I cannot reproduce how this is happening... Maybe something is faulty in your configuration? Go to "View" > "IDE Internals" > "About IDE" and remember the path listed after "Primary config directory". Close the IDE. In the Explorer rename this directory so that you later can restore it if you need to. When you now restart the IDE it will create new default settings. Does the error still occur? If not, restore by old settings and install your components, step by step, and always check for the error after each step. Maybe you can find this way which setting or which package causes the issue. ---------------------------------------------------------------------- jamie · 2024-10-04 21:01 My guess is that maybe some components or Tool helper apps maybe installed which uses bad type casting around pointers. Recently I removed a H2Pas tool that was installed in the TOOL menu, and it was causing the IDE to do weird stuff and messing around with the Source files were one of them.  Also, the tool itself has a button on the splitter side that was moving around and being out of place.  So, beware of tools or components that could be using Integer Casting around pointers. Most likely will work in 32-bit mode. ---------------------------------------------------------------------- MOSTech6502 · 2024-10-04 22:15 Quote from: wp on October 04, 2024, 04:32:37 pmMaybe something is faulty in your configuration? Go to "View" > "IDE Internals" > "About IDE" and remember the path listed after "Primary config directory". Close the IDE. In the Explorer rename this directory so that you later can restore it if you need to. When you now restart the IDE it will create new default settings. Does the error still occur? Yes, deleting and allowing recreating this folder didn't help.  Same error. Code: [Select]Lazarus version: 3.6 Lazarus revision: lazarus_3_6 Lazarus build date: 2024/09/29 Lazarus was compiled for x86_64-win64 Lazarus was compiled with FPC 3.2.2 Global IDE options: Primary config directory=C:\Users\kenne\AppData\Local\lazarus Secondary config directory=C:\lazarus LazarusDirectory=C:\lazarus\ Real LazarusDirectory=C:\lazarus\ Default CompilerFilename=$(Lazarusdir)\fpc\3.2.2\bin\x86_64-win64\fpc.exe Real Default CompilerFilename=C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe Project CompilerFilename=$(CompPath) Real Project CompilerFilename=C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe --- Quote from: jamie on October 04, 2024, 11:01:44 pmMy guess is that maybe some components or Tool helper apps maybe installed which uses bad type casting around pointers. Recently I removed a H2Pas tool that was installed in the TOOL menu, and it was causing the IDE to do weird stuff and messing around with the Source files were one of them.  Also, the tool itself has a button on the splitter side that was moving around and being out of place.  So, beware of tools or components that could be using Integer Casting around pointers. Most likely will work in 32-bit mode. Just to reiterate this is a completely fresh install of Lazarus 3.6, Windows 11 64-bit.  I have no tools or other add-ons installed, aside from what came with the installer.  (But I could try the 32-bit addon and see if that helps!) ---------------------------------------------------------------------- jamie · 2024-10-04 22:33 I don't know I always rebuild the IDE via the TOOL menu with a Clean and full build after install. ---------------------------------------------------------------------- wp · 2024-10-04 23:00 Freshly installed Laz 3.6 (64bit) on Win 11 --> no issue. Strange... Sometimes strange behaviour of Lazarus is caused by the anti-virus system. Add the Laz installation folder, as well as all project folders to the white-list of the AV. ---------------------------------------------------------------------- jamie · 2024-10-04 23:05 I wonder if he is installing it in the Programs folder and running demos which are also in the program folder at that time is causing some issue?  I know I have to install in the root folder here. ---------------------------------------------------------------------- MOSTech6502 · 2024-10-05 03:06 I guess the issue is that adding the control doesn't update the Unit file with the right side classes when drawn on the form.  Not knowing much about the how the IDE is built... is there a way I can get debug info or maybe trace how this should happen, to attempt to diagnose the error? EDIT: also, as a workaround, can someone show the expected code when PairSplitter is inserted?  I can then insert the necessary lines to get past this bug for my project, at least. ---------------------------------------------------------------------- wp · 2024-10-05 09:31 Quote from: MOSTech6502 on October 05, 2024, 05:06:09 amEDIT: also, as a workaround, can someone show the expected code when PairSplitter is inserted?  I can then insert the necessary lines to get past this bug for my project, at least. I am referring to the test project that you posted earlier. Open the lfm file (unit1.lfm) in an external editor. You'll see the PairSplitter properties like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   object PairSplitter1: TPairSplitter    Left = 10    Height = 90    Top = 10  Width = 90    Position = 45    object TPairSplitterSide      Cursor = crArrow      Left = 0      Height = 90      Top = 0      Width = 45  end    object TPairSplitterSide      Cursor = crArrow      Left = 50    Height = 90      Top = 0      Width = 40    endNote that the two TPairSplitterSide lines hightlighted above do not have variable names. Insert a unique variable name and a colon: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   object PairSplitter1: TPairSplitter    Left = 10    Height = 90    Top = 10  Width = 90    Position = 45    object PairSplitterSide1: TPairSplitterSide      Cursor = crArrow      Left = 0      Height = 90      Top = 0      Width = 45    end    object PairSplitterSide2: TPairSplitterSide      Cursor = crArrow      Left = 50      Height = 90      Top = 0      Width = 40    endNow you must also introduce the new variable names in the pas file. Open the pas file (unit1.pas) in an external editor, and add them below the PairSplitter1 declaration, but definitely above the "private" section so that the IDE can find them: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ...  TForm1 = class(TForm)    PairSplitter1: TPairSplitter;    PairSplitterSide1: TPairSplitterSide;    PairSplitterSide2: TPairSplitterSide;  private...Now you should be able to use the form in the IDE. Although you have no other choice to do so in this case, I would like to emphasize that it is not recommended to edit the lfm file in general because there is no protection against any errors that you may make, the IDE will simple refuse to open a defective lfm file... Therefore, always make a backup copy of the lfm file (or better: the entire project) before you edit it.