Recent

Author Topic: IDE Behaviour: By Design? Or Unintended?  (Read 922 times)

Aruna

  • Sr. Member
  • ****
  • Posts: 494
IDE Behaviour: By Design? Or Unintended?
« on: September 06, 2024, 03:27:26 pm »
Hello everyone,  I was highly impressed a long while back when I first started using the Lazarus IDE but recent events took things to a whole new level. I want to share what happened so someone more experienced and familiar with the IDE may be able to shed some light on what happened.

I have a project that compiles and runs fine. ( The same Custom Form Caption I was working on..) The source was in my home folder. At a later stage, I decided to move everything to my usual projects folder. I did this while the IDE was up and running. So, I move the folder and go back to the IDE, and guess what I see? Please have a look at the first screenshot. It told me 'some files have changed on disk' I was quite spooked.

When I checked the Project Inspector I was very pleasantly surprised to see the missing files identified and struck-through in red (The second screenshot shows this) I thought this was sweet and very nice. Who needs AI when the IDE seems to be able to track and think for itself :-) Absolutely amazing stuff whoever who was responsible for that code I bow to you :-)

I close the IDE. Start things up again and when I try to open the project from it's new folder. Lazarus chokes and drops to a shell. Please see below:
Code: Text  [Select][+][-]
  1. aruna@debian:~/lazarus3/lazarus$ ./lazarus --primary-config-path=~/.lazarus_test
  2. SetPrimaryConfigPath NewValue="~/.lazarus_test" expanded to "/home/aruna/.lazarus_test"
  3. Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] PrimaryConfigPath="/home/aruna/.lazarus_test"
  4. Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] SecondaryConfigPath="/etc/lazarus"
  5. TLResourceList.Sort 2 DUPLICATE RESOURCE FOUND: TDemo1:PNG
  6. TLResourceList.Sort 3 DUPLICATE RESOURCE FOUND: TDemo1:PNG
  7. TLResourceList.Sort 5 DUPLICATE RESOURCE FOUND: TDemo2:PNG
  8. TLResourceList.Sort 6 DUPLICATE RESOURCE FOUND: TDemo2:PNG
  9.  
  10. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.402: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  11. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.471: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  12. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.471: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  13. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  14. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  15. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  16. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  17. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  18. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  19. (lazarus:6735): Gtk-CRITICAL **: 08:51:34.472: IA__gtk_window_set_keep_above: assertion 'GTK_IS_WINDOW (window)' failed
  20. ----------------
  21. Hint: (lazarus) [TMainIDE.DoOpenProjectFile] "/home/aruna/hold/custom Form/customForm.lpi"
  22. The program 'lazarus' received an X Window System error.
  23. This probably reflects a bug in the program.
  24. The error was 'BadWindow (invalid Window parameter)'.
  25.   (Details: serial 19563 error_code 3 request_code 12 minor_code 0)
  26.   (Note to programmers: normally, X errors are reported asynchronously;
  27.    that is, you will receive the error a while after causing it.
  28.    To debug your program, run it with the --sync command line
  29.    option to change this behavior. You can then get a meaningful
  30.    backtrace from your debugger if you break on the gdk_x_error() function.)
  31. aruna@debian:~/lazarus3/lazarus$  View
  32.  
So I think to myself " Aruna, you went and broke the IDE. Ah hell NO!' Nothing works, New Project chokes. Open Project chokes. View Example Projects chokes. All this drops me straight back into a shell. So I resorted to Open Recent Project and selected one of my initial projects and (phew) my IDE lives again.

Now comes the interesting part. If I try to open, compile, and run my project from its new folder things get tricky. I can compile and it starts to run but I see no active form like usual. We have no form but I see the red stop button on the IDE cool bar so I know it is running. ( So where is my form? ) I am still testing and investigating this and will report back anything of interest I may find.
« Last Edit: September 06, 2024, 03:29:15 pm by Aruna »

dseligo

  • Hero Member
  • *****
  • Posts: 1393
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #1 on: September 06, 2024, 03:50:47 pm »
You tried menu Run --> Clean up and Build?

Aruna

  • Sr. Member
  • ****
  • Posts: 494
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #2 on: September 06, 2024, 04:02:45 pm »
You tried menu Run --> Clean up and Build?
I can't get to that. It gives me the project wizard. Check the attached screenshot.

Aruna

  • Sr. Member
  • ****
  • Posts: 494
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #3 on: September 06, 2024, 04:09:23 pm »
You tried menu Run --> Clean up and Build?
I misunderstood you @dseligo yes of course if you do a clean build things work fine. I am trying to understand where did my form go? (without doing a clean build) It is running but where the heck is it? 

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10454
  • Debugger - SynEdit - and more
    • wiki
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #4 on: September 06, 2024, 04:31:24 pm »
I close the IDE. Start things up again and when I try to open the project from it's new folder. Lazarus chokes and drops to a shell. Please see below:

The crash could be anchordocking. There have been some reports (partly fixed in 3.99) that when the IDE opens certain windows in certain circumstances, and anchordocking is installed, then crashes (of the kind "BadWindow " or similar) happen.

I don't have all the details on it.....

But likely the IDE was about to bring up some window with some info, and that may have just been prevented by above bug. Though, just a guess...

Aruna

  • Sr. Member
  • ****
  • Posts: 494
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #5 on: September 06, 2024, 04:42:42 pm »
The crash could be anchordocking.
Oh dear ( I love anchor-docking makes my life easy )

There have been some reports (partly fixed in 3.99) that when the IDE opens certain windows in certain circumstances, and anchordocking is installed, then crashes (of the kind "BadWindow " or similar) happen.
  Ah well we shall persevere until we find out how does the IDE run my program but does not render/display my form?

I don't have all the details on it.....
Hey, that's okay what you told me is sufficient for me to proceed to trouble-shoot this missing form/window :-)

But likely the IDE was about to bring up some window with some info, and that may have just been prevented by above bug. Though, just a guess...
I think very good guess :-)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10454
  • Debugger - SynEdit - and more
    • wiki
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #6 on: September 06, 2024, 04:57:27 pm »
Here is the most recent issue I had seen https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41041

There is some partial fix, IIRC, just go through the comments, and find the commit...

VisualLab

  • Hero Member
  • *****
  • Posts: 519
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #7 on: September 06, 2024, 07:13:29 pm »
From what I remember, if:
  • Lazarus has the AnchorDocking, AnchorDockingDsgn (and probably DockedFormEditor) packages installed
  • you work on a computer with more than 1 monitor (2 and more)

and then you open the project on another computer with 1 monitor (or on the same computer after unplugging the 2nd monitor), then the form window may not be displayed properly (or at all). Moreover, the vertical scroll bar was not visible in the source code editor.

Changes to the project settings files helped. Unfortunately, it happened to me once and I don't remember the options I changed. I did it by feel, gradually, one change at a time.

Aruna

  • Sr. Member
  • ****
  • Posts: 494
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #8 on: September 06, 2024, 10:09:41 pm »
From what I remember, if:
  • Lazarus has the AnchorDocking, AnchorDockingDsgn (and probably DockedFormEditor) packages installed
  • you work on a computer with more than 1 monitor (2 and more)

and then you open the project on another computer with 1 monitor (or on the same computer after unplugging the 2nd monitor), then the form window may not be displayed properly (or at all). Moreover, the vertical scroll bar was not visible in the source code editor.

Changes to the project settings files helped. Unfortunately, it happened to me once and I don't remember the options I changed. I did it by feel, gradually, one change at a time.
Hi @VisualLab, I do have a rather old Sony TV that I use as a second monitor when needed. ( It's there if I ever need a second monitor )

I still can't figure out where my form is. This is like voodoo magic. The IDE runs does not choke. we have a greyed-out arrow button and the stop/terminate square button on the toolbar has turned pretty red. So I ask you again Mr.Lazarus where did you hide my form? (Give me some time, I will figure it out :-)

alpine

  • Hero Member
  • *****
  • Posts: 1269
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #9 on: September 06, 2024, 10:27:57 pm »
I still can't figure out where my form is. This is like voodoo magic. The IDE runs does not choke. we have a greyed-out arrow button and the stop/terminate square button on the toolbar has turned pretty red. So I ask you again Mr.Lazarus where did you hide my form? (Give me some time, I will figure it out :-)
While running your program you may try the following:
Press Alt+Tab several times until you activated the main form of your app (I assume it is not visible on-screen and that is your problem)
Press Alt+Space to activate the system menu
Press M for 'Move'
Press one of the arrow keys: Up, Down, Left, Right
Start moving the mouse, there is a chance that the window will appear attached to the cursor

I'm using that combination often when I "lose" a window. It works in my Winbox and in my Ubuntu/Xfce box. Not sure it will work for your window manager, though.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

dsiders

  • Hero Member
  • *****
  • Posts: 1258
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #10 on: September 06, 2024, 10:37:10 pm »
From what I remember, if:
  • Lazarus has the AnchorDocking, AnchorDockingDsgn (and probably DockedFormEditor) packages installed
  • you work on a computer with more than 1 monitor (2 and more)

and then you open the project on another computer with 1 monitor (or on the same computer after unplugging the 2nd monitor), then the form window may not be displayed properly (or at all). Moreover, the vertical scroll bar was not visible in the source code editor.

Changes to the project settings files helped. Unfortunately, it happened to me once and I don't remember the options I changed. I did it by feel, gradually, one change at a time.
Hi @VisualLab, I do have a rather old Sony TV that I use as a second monitor when needed. ( It's there if I ever need a second monitor )

I still can't figure out where my form is. This is like voodoo magic. The IDE runs does not choke. we have a greyed-out arrow button and the stop/terminate square button on the toolbar has turned pretty red. So I ask you again Mr.Lazarus where did you hide my form? (Give me some time, I will figure it out :-)

Check the values in Top, Left, and Position in the TForm instance. Perhaps Top and Left are off (out-of-bounds). Or, use Position to force it to center on the active monitor. Look at the LFM file to see what the streamed properties contain.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

Aruna

  • Sr. Member
  • ****
  • Posts: 494
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #11 on: September 07, 2024, 03:59:04 am »
@alpine and @dsiders thank you both for your suggestions. I finally figured out the reason I am unable to see the darn form. In the customForm.lpr what I see is this:
Code: Pascal  [Select][+][-]
  1. begin
  2.   RequireDerivedFormResource:=True;
  3.   Application.Scaled:=True;
  4.   Application.Initialize;
  5.   Application.Run;
  6. end.
  7.  

It was missing the line:
Code: Pascal  [Select][+][-]
  1. Application.CreateForm(TForm1, Form1);

So I have a new problem now. I plugged in the missing line and the IDE complains:
Code: Pascal  [Select][+][-]
  1. customForm.lpr(21,26) Error: Identifier not found "TForm1"
Screenshot is attached.   

Aruna

  • Sr. Member
  • ****
  • Posts: 494
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #12 on: September 07, 2024, 04:09:13 am »
Here is the most recent issue I had seen https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41041

There is some partial fix, IIRC, just go through the comments, and find the commit...
Thank you and will do!

alpine

  • Hero Member
  • *****
  • Posts: 1269
Re: IDE Behaviour: By Design? Or Unintended?
« Reply #13 on: September 07, 2024, 08:22:36 am »
Quote
So I have a new problem now. I plugged in the missing line and the IDE complains:
  :D
Make sure the corresponding .pas file is included in the project (and not stroked through with a red line) and then go to "Project Options/Forms". If Form1 is not into the "Auto-create forms:" list then include it.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

 

TinyPortal © 2005-2018