Recent

Author Topic: TPairSplitter control leads to crash  (Read 846 times)

MOSTech6502

  • Newbie
  • Posts: 4
TPairSplitter control leads to crash
« on: October 04, 2024, 04:55:45 am »
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

  • Full Member
  • ***
  • Posts: 205
Re: TPairSplitter control leads to crash
« Reply #1 on: October 04, 2024, 07:46:50 am »
Hello,

I can't confirm the behaviour you desribed.
Linux Mint / Windows 10 / Lazarus 3.6.0 / trunk

dseligo

  • Hero Member
  • *****
  • Posts: 1406
Re: TPairSplitter control leads to crash
« Reply #2 on: October 04, 2024, 09:58:07 am »
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."

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.

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

If the issue is as I described, that is probably connected with it.

dseligo

  • Hero Member
  • *****
  • Posts: 1406
Re: TPairSplitter control leads to crash
« Reply #3 on: October 04, 2024, 10:05:15 am »
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

  • Hero Member
  • *****
  • Posts: 12459
Re: TPairSplitter control leads to crash
« Reply #4 on: October 04, 2024, 11:02:59 am »
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
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

  • Hero Member
  • *****
  • Posts: 1406
Re: TPairSplitter control leads to crash
« Reply #5 on: October 04, 2024, 11:41:55 am »
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
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

  • Hero Member
  • *****
  • Posts: 12459
Re: TPairSplitter control leads to crash
« Reply #6 on: October 04, 2024, 12:50:24 pm »
Quote
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.
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.
« Last Edit: October 05, 2024, 12:25:33 am by wp »

MOSTech6502

  • Newbie
  • Posts: 4
Re: TPairSplitter control leads to crash
« Reply #7 on: October 04, 2024, 02:56:25 pm »
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.

« Last Edit: October 04, 2024, 03:00:44 pm by MOSTech6502 »

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: TPairSplitter control leads to crash
« Reply #8 on: October 04, 2024, 04:32:37 pm »
In 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.
« Last Edit: October 04, 2024, 11:58:46 pm by wp »

jamie

  • Hero Member
  • *****
  • Posts: 6734
Re: TPairSplitter control leads to crash
« Reply #9 on: October 04, 2024, 11:01:44 pm »
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.
The only true wisdom is knowing you know nothing

MOSTech6502

  • Newbie
  • Posts: 4
Re: TPairSplitter control leads to crash
« Reply #10 on: October 05, 2024, 12:15:18 am »
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?

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

---

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.


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

  • Hero Member
  • *****
  • Posts: 6734
Re: TPairSplitter control leads to crash
« Reply #11 on: October 05, 2024, 12:33:23 am »
I don't know I always rebuild the IDE via the TOOL menu with a Clean and full build after install.

The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: TPairSplitter control leads to crash
« Reply #12 on: October 05, 2024, 01:00:01 am »
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.
« Last Edit: October 05, 2024, 01:04:04 am by wp »

jamie

  • Hero Member
  • *****
  • Posts: 6734
Re: TPairSplitter control leads to crash
« Reply #13 on: October 05, 2024, 01:05:17 am »
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.
The only true wisdom is knowing you know nothing

MOSTech6502

  • Newbie
  • Posts: 4
Re: TPairSplitter control leads to crash
« Reply #14 on: October 05, 2024, 05:06:09 am »
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.

 

TinyPortal © 2005-2018