Recent

Author Topic: Cocoa dialog stays on top when debugging  (Read 1817 times)

VTwin

  • Hero Member
  • *****
  • Posts: 664
  • Former Turbo Pascal 3 user
Cocoa dialog stays on top when debugging
« on: December 16, 2018, 11:37:26 pm »
If I execute, for example, a TOpenDialog, and try to step through code after calling execute, the dialog remains on top. I have to move the forms around to see what is happening in the IDE.

Code: Pascal  [Select]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   dlg: TOpenDialog;
  4. begin
  5.   try
  6.     dlg := TOpenDialog.Create(nil);
  7.     if dlg.Execute then begin
  8.       Label1.Caption := dlg.FileName; // set breakpoint here
  9.     end;
  10.   finally
  11.     dlg.Free;
  12.   end;
  13. end;

This seems unique to cocoa. Is anyone aware of bug reports on this?
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61357M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

Hansaplast

  • Hero Member
  • *****
  • Posts: 534
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa dialog stays on top when debugging
« Reply #1 on: December 17, 2018, 05:48:01 pm »
Confirmed;
Just tested it with GDB, and you're right, the dialog remains open even after stopping the debugging (the application doesn't seem to terminate). Even after Force Quit, the dialog remains open.
In a few minutes I'll try LLDB as well.

Hansaplast

  • Hero Member
  • *****
  • Posts: 534
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa dialog stays on top when debugging
« Reply #2 on: December 17, 2018, 05:52:14 pm »

Confirmed with LLDB;
For both "LLDB Debugger (Alpha)" and "LLDB Debugger (with fbdebug)(Beta)";
window remains open while stepping through, but closes when one terminates the debugging.


Sounds like some that should be reported with BugTracker:)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5390
    • wiki
Re: Cocoa dialog stays on top when debugging
« Reply #3 on: December 17, 2018, 06:05:27 pm »
Confirmed;
Just tested it with GDB, and you're right, the dialog remains open even after stopping the debugging (the application doesn't seem to terminate). Even after Force Quit, the dialog remains open.
In a few minutes I'll try LLDB as well.

Sounds like 2 different things?

The original issue as far as I understand is that the "open dialog" is a system-wide-stay-on-top, and as long as the app runs (or is paused, but not yet terminated) the dialog is on top (until one selects a file and presses ok, presumingly).

Your description indicates, that even if the debugger stops/terminates the app, then open-dialog remains?
So then "ps ax" did the app terminate?

Can you check in "debug output" (Menu: View -> IDE Internals / or 1.8.x: View > Debug Windows), if the IDE did send a "kill" to the gdb?

--------------------
As for the stay on top:

What happens if you do NOT debug. Just run your app ("run without debug") and open the dialog. While the dialog is open, can you bring any window in front of that dialog.
Also start your app outside the IDE, and check if any other window can come in front of the dialog.


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2107
    • havefunsoft.com
Re: Cocoa dialog stays on top when debugging
« Reply #4 on: December 17, 2018, 06:09:19 pm »
The original issue as far as I understand is that the "open dialog" is a system-wide-stay-on-top, and as long as the app runs (or is paused, but not yet terminated) the dialog is on top (until one selects a file and presses ok, presumingly).
the only valid test is to run the application w/o a debugger, open up the dialog and see if it says system-wide.

Otherwise, I'd think that the debugger launched from IDE is considered part of the application (child process) and yet the application ran by debugger is also considered as part of the same application. Thus the dialog becomes the entire application  (IDE + debugger + debugged process) stay-on-top.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5390
    • wiki
Re: Cocoa dialog stays on top when debugging
« Reply #5 on: December 17, 2018, 07:25:02 pm »
Otherwise, I'd think that the debugger launched from IDE is considered part of the application (child process) and yet the application ran by debugger is also considered as part of the same application. Thus the dialog becomes the entire application  (IDE + debugger + debugged process) stay-on-top.

That is why I wanted to know if it happens when run from the IDE with "run without debugger". That would be a child process too.

In any case:
- If it is system wide, then the question is, if that is for Lazarus app only, or any cocoa app. If the latter, then nothing can be done.

- If it is child process based, well, I don't know if the process can be detached in any other way.
I did not see an option in lldb. And I do not know if the bounds between the IDE and lldb can be severed....

VTwin

  • Hero Member
  • *****
  • Posts: 664
  • Former Turbo Pascal 3 user
Re: Cocoa dialog stays on top when debugging
« Reply #6 on: December 18, 2018, 03:41:33 am »
I was running this with lldb debugger (with fpdebug Beta). If I run it without debugging, other application windows can cover it, it seems normal.

I have debugged in Carbon, Windows, and Linux without encountering this. To be clear this happens after selecting a file, but before freeing the dialog.

Off this topic, there are other issues in Cocoa Lazarus IDE, context menus don't work, I can't delete or copy and paste controls. So I must design in Carbon, then test in Cocoa. One step at a time, grateful for the improvements.

 
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61357M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 664
  • Former Turbo Pascal 3 user
Re: Cocoa dialog stays on top when debugging
« Reply #7 on: December 18, 2018, 04:14:22 am »
I can report, but appreciate comments. I assume this is a cocoa bug, but it seems to occur only in the ide.

Can anyone confirm the contextual menu bug? Or that cut and paste do not work in the form designer?

I can report those as well. :(
« Last Edit: December 18, 2018, 04:17:01 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61357M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2107
    • havefunsoft.com
Re: Cocoa dialog stays on top when debugging
« Reply #8 on: December 18, 2018, 05:13:19 am »
Can anyone confirm the contextual menu bug? Or that cut and paste do not work in the form designer?
trunk or RC2?
naturally, if it works in trunk, no need to report
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

VTwin

  • Hero Member
  • *****
  • Posts: 664
  • Former Turbo Pascal 3 user
Re: Cocoa dialog stays on top when debugging
« Reply #9 on: December 18, 2018, 02:51:43 pm »
Thanks for confirming on other debuggers.  This occurs in trunk.

Thanks for input. The dialog is not system modal, but is modal to IDE, and stays modal and is not hidden after execute is completed. In any case the behavior is incorrect. I reported three bugs:

https://bugs.freepascal.org/view.php?id=34716
https://bugs.freepascal.org/view.php?id=34717
https://bugs.freepascal.org/view.php?id=34718

Thanks,
VTwin

“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61357M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)