Recent

Author Topic: Lazreport kills the application unpredictably  (Read 15128 times)

sydenis

  • New Member
  • *
  • Posts: 32
Re: Lazreport kills the application unpredictably
« Reply #15 on: July 30, 2021, 11:41:54 am »
@sydenis
It works fine for me with Lazarus Trunk/FPC 3.2.0/Win10. There is no crash with fsStayOnTop.

Are you on linux?
I wrote above that everything worked fine for me on w10
« Last Edit: July 30, 2021, 11:44:27 am by sydenis »

balazsszekely

  • Guest
Re: Lazreport kills the application unpredictably
« Reply #16 on: July 30, 2021, 11:53:46 am »
Quote
Are you on linux?
I wrote above that everything worked fine for me on w10
Yes, I can reproduce it on my linux mint VM(gtk2). Let me see if I can find what cause the exception.

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: Lazreport kills the application unpredictably
« Reply #17 on: July 31, 2021, 01:34:51 am »
I cannot reproduce it here, xubuntu Lazarus 2.2 RC 1 fpc 3.2.0 both in gtk2 and qt5.
Maybe I don't have the same settings, please share a project + report that can reproduce the problem.

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: Lazreport kills the application unpredictably
« Reply #18 on: July 31, 2021, 03:23:20 am »
There is no crash with fsStayOnTop / fsSystemStayOnTop.
Linux Mint 19.3 gtk2.
I've tested it in different reports.
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

sydenis

  • New Member
  • *
  • Posts: 32
Re: Lazreport kills the application unpredictably
« Reply #19 on: July 31, 2021, 09:19:04 am »
I guess that Ububntu and Mint are based on different versions of Gnome. On Monday, I will send a project with a report. Sorry I can't do it right now.

I use Ubuntu 20.04.1   Gnome 3.36.7

sydenis

  • New Member
  • *
  • Posts: 32
Re: Lazreport kills the application unpredictably
« Reply #20 on: August 02, 2021, 04:43:44 pm »
Here is a test project.
Ubuntu 20.04.1 + Lazarus 2.0.12 (on 2.2 then same situation)
If your report opened immediately without any problems (I also had this), then try closing it and clicking the Button1 a few more times. The report will not open more than once.

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: Lazreport kills the application unpredictably
« Reply #21 on: August 08, 2021, 05:54:28 pm »
it was a little difficult to trigger the problem, but finally I made it. It's not LazReport related, it is a X11 error triggered by gtk (had to guess that too as my IDE was compiled for qt5 and it compiles qt5 apps by default), but I found an easier way to expose the problem using only the IDE (that must be compiled for GTK), do this:

1. Open a file that has some repeated words, for example any pascal file for the word "begin"
2. CTRL+R or open the replace dialog
3. In the "Text to find" field type 'begin' without '
4. In the "Replace with" field type 'Begin' again without '
5. The "Prompt on replace" option must be checked, all other option checkboxes should be clear, all radio options default.
6. Press the button "Replace all"

It will do an annoying blink of windows and will find the first instance showing a confirmation dialog, from there press the "Yes" button and Lazarus will vanish in the ether. If you run Lazarus in a terminal, it will show this:

The program 'lazarus' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 293718 error_code 3 request_code 12 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

This is the same error that kills your program.

If you can reproduce this problem with the given instructions then try this:

NOTE: "Remember your changes so your can restore the original code"

1. Open your application
2. Open the project inspector (menu Project->Project inspector);
3. Under "Required Package" double click the LCL package
4. In the new window, under "Files" find and open the gtk2widgetset.inc file
5. Find this function "TGtk2WidgetSet.AppRemoveStayOnTopFlags"
6. Replace this code:

Code: Pascal  [Select][+][-]
  1.         if Assigned(nact) then
  2.         begin
  3.           gdk_window_restack(W^.Window, act, False);
  4.           nact:=W^.Window;
  5.         end
  6.         else begin
  7.           gdk_window_lower(W^.Window); // send to the bottom
  8.           gdk_window_raise(W^.Window); // restore back
  9.         end;
  10.  

with this ( or by nothing, not tested but it was the original code before that change)

Code: Pascal  [Select][+][-]
  1.         gdk_window_lower(W^.Window); // flush it to the bottom, some WMs keep it above
  2.         gdk_window_raise(W^.Window); // bring it back immediatly. But it should keep below the top app
  3.  

Save the file and recompile your program, I was not able to crash it after this, please test and comment.
By the way, I did my tests with current Lazarus (Lazarus 2.3.0 rmain-2_3-255-gfd378d5 FPC 3.2.2 x86_64-linux-gtk2)
« Last Edit: August 08, 2021, 05:59:47 pm by jesusr »

 

TinyPortal © 2005-2018