KLayout / klayout

KLayout Main Sources
http://www.klayout.org
GNU General Public License v3.0
804 stars 205 forks source link

[Qt6] Cannot normally quit the main application window #1602

Closed Kazzz-S closed 9 months ago

Kazzz-S commented 9 months ago

Previously, I thought the problem captured in the attached video was macOS-specific. However, I have found that it is also reproducible on Linux. So I could collect the valgrind output.

1. OS and Compiler

2. Qt

MyHost{sekigawa}(4)$ ./qmake --version QMake version 3.1 Using Qt version 6.6.1 in /usr/local/Qt-6.6.1/lib



----
* Video

https://github.com/KLayout/klayout/assets/16847255/5a2a1838-70a5-466b-9940-ee1b23f34cf2

* valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s
[case-04-valgrind_output.zip](https://github.com/KLayout/klayout/files/14093121/case-04-valgrind_output.zip)
klayoutmatthias commented 9 months ago

Hi @Kazzz-S,

I tried myself on Ubuntu 22.04 with on-board Qt 6.2.1 and I see normal behavior. I built without Qt bindings for now, but I will try with. I also have Qt 6.4.2 and will try this one too.

Matthias

stefanottili commented 9 months ago

On MacOS M1 klayout hangs on exit without qt-bindings. Compiled with homebrew qt6 which is currently using qt 6.6.1

klayoutmatthias commented 9 months ago

No luck with Ubuntu 22 and Qt 6.4.2 that comes with Qt Creator :(

@Kazzz-S I noticed one thing in the video above: when you open the layout it appears to take a while to load. A progress bar should be displayed while it does so. On the other hand your layout isn't large, so what is happening during that time?

There are more things to test:

1.) Maybe some popup is showing which can't be dismissed? I had such issues when starting KLayout and some tip dialogs appeared on screens that were not active.I tried to make dialogs appear on the same screen than the main application where possible and I have no clue what dialog could appear. There is one about saving the layout, but that's all. A simple check may be to try in viewer mode (there should not be any save needed) or to try without a layout loaded. Does the problem happen in that case too?

2.) Any useful output on the terminal when you run KLayout with verbose logging on, i.e. "-d 31" or even "-d 41", like "klayout -d 41"?

3.) There are some other ways to exit unconditionally:

Does one of these methods work?

4.) Potentially the problem is located somewhere in the MainWindow::can_close method in layMainWindow.cc, line 1409. This function can veto against closing the window by returning false. You could put in some printf statements to find out whether or why it would return false or do trial-and-error by putting in return true statements at strategic places to see where is a the reason for failing to return true.

If you put a return true right at the beginning like this:

bool
MainWindow::can_close ()
{
  return true;
...
}

the program should exit in any case but also without any warnings. If it does not, the problem is not inside this function.

Matthias

Kazzz-S commented 9 months ago

Hello @klayoutmatthias,

@Kazzz-S I noticed one thing in the video above: when you open the layout it appears to take a while to load. A progress bar should be displayed while it does so. On the other hand your layout isn't large, so what is happening during that time?

I think the time it took to load the design was because I was running KLayout (debug build) under the hood of valgrind. The design is so small that the progress bar would not appear in a normal run.

The small window size was intentional to keep the size of the captured video file small.

I'll try all the suggested tests and get back to you.

Regards, Kazzz-S

klayoutmatthias commented 9 months ago

Thanks, I'm curious what will be the outcome :)

Matthias

Kazzz-S commented 9 months ago

@klayoutmatthias, I've conducted the four experiments. I'll show the results one by one.

0. About

https://github.com/KLayout/klayout/assets/16847255/6552d8e1-4df9-48f3-9072-8a4c0c99e5ae

Kazzz-S commented 9 months ago

Test-1. Read-Only mode

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test1.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-1: Read-Only mode
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH
eval "$KLAYOUT_EXE -style=fusion -ne $*"

(a) File -> Exit

https://github.com/KLayout/klayout/assets/16847255/55f10732-6d65-4400-9d92-f6dc40a2c652

(b) Window's Close [X]

https://github.com/KLayout/klayout/assets/16847255/4a967a3e-8f11-4241-851e-4eacc7a04e4a


1.) Maybe some popup is showing which can't be dismissed? I had such issues when starting KLayout and some tip dialogs appeared on screens that were not active.

I cannot see such a popup or dialog.

Kazzz-S commented 9 months ago

Test-2. -d 41 option

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test2.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-2: "-d 41" option
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH
eval "$KLAYOUT_EXE -style=fusion -d 41 $* > ./gh1602-test2.log 2>&1"

(a) File -> Exit

https://github.com/KLayout/klayout/assets/16847255/09808cd9-35fe-4775-a854-5db12d7e020a

gh1602-test2-(a).zip

(b) Window's Close [X]

https://github.com/KLayout/klayout/assets/16847255/fbc3ce09-e22f-495e-8e15-ec7909809efd

gh1602-test2-(b).zip


There are many Warnings in the output log file.

Warning: Class QJsonArray_Iterator: no Python mapping for method ->
Warning: Class QJsonObject_Iterator: no Python mapping for method ->
Warning: Class QMetaObject_SuperData: no Python mapping for method ->
Warning: Class QRandomGenerator: no Python mapping for method (reserved word) global
Warning: Class QRandomGenerator64: no Python mapping for method (reserved word) global
Warning: Class QDrag_Native: no Python mapping for method (reserved word) exec
Warning: Class QDrag_Native: no Python mapping for method (reserved word) exec
Warning: Class QPageSetupDialog_Native: no Python mapping for method (reserved word) exec
Warning: Class QSqlDatabase: no Python mapping for method (reserved word) exec
Warning: Class QSqlResult: no Python mapping for method (reserved word) exec
Warning: Class Edges: no Python mapping for method (reserved word) and
Warning: Class Edges: no Python mapping for method (reserved word) and
Warning: Class Edges: no Python mapping for method (reserved word) not
Warning: Class Edges: no Python mapping for method (reserved word) not
Warning: Class Edges: no Python mapping for method (reserved word) or
Warning: Class Edges: no Python mapping for method (reserved word) in
Warning: Class Region: no Python mapping for method (reserved word) and
Warning: Class Region: no Python mapping for method (reserved word) not
Warning: Class Region: no Python mapping for method (reserved word) or
Warning: Class Region: no Python mapping for method (reserved word) in
Warning: Class Region: no Python mapping for method (reserved word) break
Warning: Class QCoreApplication_Native: no Python mapping for method (reserved word) exec
Warning: Class QEventLoop_Native: no Python mapping for method (reserved word) exec
Warning: Class QThread: no Python mapping for method (reserved word) exec
Warning: Class QGuiApplication_Native: no Python mapping for method (reserved word) exec
Warning: Class QTextDocument_Native: no Python mapping for method (reserved word) print
Warning: Class QWindow_Native: no Python mapping for method (reserved word) raise
Warning: Class QApplication_Native: no Python mapping for method (reserved word) exec
Warning: Class QWidget_Native: no Python mapping for method (reserved word) raise
Warning: Class QPrintPreviewWidget_Native: no Python mapping for method (reserved word) print
Warning: Class QSqlQuery: no Python mapping for method (reserved word) exec
Warning: Class QSqlQuery: no Python mapping for method (reserved word) exec
Warning: Class Application: no Python mapping for method (reserved word) exec
Warning: Class QDialog_Native: no Python mapping for method (reserved word) exec
Warning: Class QDialog: no Python mapping for method (reserved word) exec
Warning: Class QErrorMessage: no Python mapping for method (reserved word) exec
Warning: Class QFileDialog: no Python mapping for method (reserved word) exec
Warning: Class QFontDialog: no Python mapping for method (reserved word) exec
Warning: Class QInputDialog: no Python mapping for method (reserved word) exec
Warning: Class QLineEdit_Native: no Python mapping for method (reserved word) del
Warning: Class QMenu_Native: no Python mapping for method (reserved word) exec
Warning: Class QMenu_Native: no Python mapping for method (reserved word) exec
Warning: Class QMenu_Native: no Python mapping for method (reserved word) exec
Warning: Class QMessageBox: no Python mapping for method (reserved word) exec
Warning: Class QProgressDialog: no Python mapping for method (reserved word) exec
Warning: Class QWizard: no Python mapping for method (reserved word) exec
Warning: Class QAbstractPrintDialog: no Python mapping for method (reserved word) exec
Warning: Class QPrintDialog_Native: no Python mapping for method (reserved word) exec
Warning: Class QPrintDialog: no Python mapping for method (reserved word) exec
Warning: Class QPrintPreviewDialog: no Python mapping for method (reserved word) exec
Warning: Class BrowserDialog: no Python mapping for method (reserved word) exec
Warning: Class QColorDialog: no Python mapping for method (reserved word) exec
Warning: Class QPlainTextEdit_Native: no Python mapping for method (reserved word) print
Warning: Class QTextEdit_Native: no Python mapping for method (reserved word) print
Warning: The X11 connection broke (error 1). Did the X11 server die?
Kazzz-S commented 9 months ago

Test-3. Using the macro editor console

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test3.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-3: Using the macro editor console
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH
eval "$KLAYOUT_EXE -style=fusion $*"

(a) exit!

https://github.com/KLayout/klayout/assets/16847255/bccfe87d-1ac3-4408-93be-cf892f6deeab

(b) RBA::Application.instance.exit(0)

https://github.com/KLayout/klayout/assets/16847255/52c09291-e834-4e22-aa4a-577be4c65f69

Kazzz-S commented 9 months ago

Test-4. Code Changes

code-change-1 code-change-2

Kazzz-S commented 9 months ago

Test-4A. Without force return

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test4A.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-4: With debug codes added to "layMainWindow.cc"
#         A) 'MAGIC_FORCE_TRUE' env. variable unset
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH

unset MAGIC_FORCE_TRUE
eval "$KLAYOUT_EXE -style=fusion $*  > ./gh1602-test4A.log 2>&1"

(a) File -> Exit

https://github.com/KLayout/klayout/assets/16847255/77f53c5a-3989-4414-aab0-094bfd2635a2

In MainWindow::can_close:: 1) Application seems not to be busy
In MainWindow::can_close:: 2) Plugins seem to be ready to exit
In MainWindow::can_close:: 3) No need to save a layout
In MainWindow::can_close:: 1) Application seems not to be busy
In MainWindow::can_close:: 2) Plugins seem to be ready to exit
In MainWindow::can_close:: 3) No need to save a layout

(b) Window's Close [X]

https://github.com/KLayout/klayout/assets/16847255/baf6d798-ae9e-4007-a8c7-d4b0f1152aa1

In MainWindow::can_close:: 1) Application seems not to be busy
In MainWindow::can_close:: 2) Plugins seem to be ready to exit
In MainWindow::can_close:: 3) No need to save a layout
Kazzz-S commented 9 months ago

Test-4B. With force return

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test4B.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-4: With debug codes added to "layMainWindow.cc"
#         B) 'MAGIC_FORCE_TRUE' env. variable set
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH

export MAGIC_FORCE_TRUE="CAN_CLOSE_MAINWINDOW"
eval "$KLAYOUT_EXE -style=fusion $*  > ./gh1602-test4B.log 2>&1"

(a) File -> Exit

https://github.com/KLayout/klayout/assets/16847255/26910b5a-ee6d-4f15-844a-5bfb8d6c7557

In MainWindow::can_close:: 0) Forcibly return 'true'
In MainWindow::can_close:: 0) Forcibly return 'true'

(b) Window's Close [X]

https://github.com/KLayout/klayout/assets/16847255/0b8d4212-0dd8-418c-87b8-99f1a9fb82fa

In MainWindow::can_close:: 0) Forcibly return 'true'
Kazzz-S commented 9 months ago

It looks like the problem is NOT inside MainWindow::can_close ()!

klayoutmatthias commented 9 months ago

Hi @Kazzz-S,

thanks a lot for these experiments.

I now got Qt 6.6.1 myself and tried to reproduce the issue on Ubuntu, without success. The application simply closes.

I conclude, that can_close is called which means some other problem is present.

The warnings from the log file just say that some methods are renamed because their names are reserved words in Python. That is normal. The log does not indicate any issues.

I have some more things I can suggest to try:

"can_close" is actually called from inside MainWindow::exit. This method is found in layMainWindow.cc, line 1365++:

  //  Only after other operation has finished we ask whether to save and close eventually
  if (can_close ()) {

    do_close ();
    QMainWindow::close ();

    emit closed ();

  } else {
    m_exited = false;
  }

I would try to check whether the code gets to these places (1) to (4):

  if (can_close ()) {

    //  (1)
    do_close ();
    //  (2)
    QMainWindow::close ();

    //  (3)
    emit closed ();
    //  (4)

  } else {
    m_exited = false;
  }

Even though there is no return statement, some methods may raise an exception for some reason which could prevent the method from closing the window.

If that happens, for example if (1) is reached, but (2) isn't, the exception can be captured to reveal the reason, like this:

  if (can_close ()) {

    //  (1)
    BEGIN_PROTECTED
      do_close ();
    END_PROTECTED
    //  (2)
    QMainWindow::close ();

    //  (3)
    emit closed ();
    //  (4)

  } else {
    m_exited = false;
  }

"BEGIN_PROTECTED" and "END_PROTECTED" are macros that insert try .. catch statements and print the error before continuing.

I'm sorry for this kind of remote debugging, but I wish I could reproduce the problem on my side.

Best regards,

Matthias

Kazzz-S commented 9 months ago

Hello @klayoutmatthias,

I'm sorry for this kind of remote debugging, but I wish I could reproduce the problem on my side.

No need to worry. I plan to do these additional experiments in my office environment tomorrow.

Best regards, Kazzz-S

Kazzz-S commented 9 months ago

Hello @klayoutmatthias,

Unfortunately, I could not catch exceptions, as shown below. Please give me the next assignment, if any.

Best regards, Kazzz-S


Test-5. Try to catch some exceptions while "do_close ()"

Code Changes code-change-3

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test5.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-4: With debug codes added to "layMainWindow.cc"
#         to catch some exceptions while "do_close ()".
#         'MAGIC_FORCE_TRUE' env. variable is also unset.
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH

unset MAGIC_FORCE_TRUE
eval "$KLAYOUT_EXE -style=fusion $*  > ./gh1602-test5.log 2>&1"

(a) File -> Exit

https://github.com/KLayout/klayout/assets/16847255/49c4f611-8105-4d2f-a1f1-50bc4f338ce3

In MainWindow::can_close:: 1) Application seems not to be busy
In MainWindow::can_close:: 2) Plugins seem to be ready to exit
In MainWindow::can_close:: 3) No need to save a layout
In MainWindow::exit:: can_close () is true. Going to start 'gh1602-test5'...
In MainWindow::exit:: (1) reached
In MainWindow::exit:: (2) reached
In MainWindow::exit:: (3) reached
In MainWindow::exit:: (4) reached
In MainWindow::can_close:: 1) Application seems not to be busy
In MainWindow::can_close:: 2) Plugins seem to be ready to exit
In MainWindow::can_close:: 3) No need to save a layout
In MainWindow::exit:: can_close () is true. Going to start 'gh1602-test5'...
In MainWindow::exit:: (1) reached
In MainWindow::exit:: (2) reached
In MainWindow::exit:: (3) reached
In MainWindow::exit:: (4) reached

(b) Window's Close [X]

https://github.com/KLayout/klayout/assets/16847255/2dfc2de4-9843-4670-852f-13e2f48c5a02

In MainWindow::can_close:: 1) Application seems not to be busy
In MainWindow::can_close:: 2) Plugins seem to be ready to exit
In MainWindow::can_close:: 3) No need to save a layout
In MainWindow::exit:: can_close () is true. Going to start 'gh1602-test5'...
In MainWindow::exit:: (1) reached
In MainWindow::exit:: (2) reached
In MainWindow::exit:: (3) reached
In MainWindow::exit:: (4) reached

I have also tested the code below. But the results remain unchanged. code-change-4

klayoutmatthias commented 9 months ago

Hi @Kazzz-S,

Thanks again for these inputs.

But that basically means that although QMainWindow::close is called between (2) and (3), the window does not close :(

I think I have to dig through the Qt code if that makes any sense ...

Matthias

Kazzz-S commented 9 months ago

Test-6. Debug with QtCreator

Hello @klayoutmatthias,

I tried debugging with QtCreator (I'm unfamiliar with it, but it is a good opportunity to learn) :-) I reached the location shown in the attached video. Qt6-lldb

https://github.com/KLayout/klayout/assets/16847255/147a9739-90bb-4d1d-b964-09a4a04a045c

So, I made some changes to the codes, as shown below. The relevant commit is here.

code-change-5 code-change-6


Test driver

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test6.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-4: With debug codes added to "layMainWindow.cc"
#         to catch some exceptions while "do_close ()".
#         'MAGIC_FORCE_TRUE' env. variable is also unset.
#
# Test-6: Changed "layApplication.cc" to report about do_notify().
#         This is activated by the two environment variables:
#             * MAGIC_MAINWINDOW_EXITED="ACTIVE"
#             * MAGIC_REPORT_NOTIFY="ACTIVE"
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH

unset MAGIC_FORCE_TRUE
export MAGIC_MAINWINDOW_EXITED="ACTIVE"
eval "$KLAYOUT_EXE -style=fusion $*  > ./gh1602-test6.log 2>&1"

Kazzz-S

Kazzz-S commented 9 months ago

cont.

code-change-7

Observations

The output log files are in test6-logs@2.zip


When killed the Qt6 version process 600 seconds after File -> Exit****

klayoutmatthias commented 9 months ago

Hello @Kazzz-S,

thanks a lot for these experiments.

Good news is that I can reproduce the issue now myself :) But only with a Qt 6.6.1 version built from the sources.

I actually made a mistake here:

void
MainWindow::closeEvent (QCloseEvent *event)
{
  if (! m_exited) {
    BEGIN_PROTECTED
    exit ();
    END_PROTECTED
  }

  event->ignore ();
}

According to the documentation, closeEvent should not close the application if the event is ignored. Interestingly, Qt still closes the application in most cases. Maybe some Qt bugfix now restores the documented behavior and this explains the effect we see.

The original reason for that implementation was a commit back in 2017 when I observed crashed when closing the application while operations were running (hence the 'busy' query). In that case it is correct to ignore the event.

Maybe you can try this patch: https://github.com/KLayout/klayout/commit/e93174153ad816afffb1b1fceff4ff6035a206a4

In my case this fixes the problem.

Best regards and thanks for all your efforts!

Matthias

stefanottili commented 9 months ago

yay, this works on macOS Sonoma M1 build4mac.py -r HB32 -p HBAuto -q Qt6Brew -m '--jobs=8' -n -u homebrew qt 6.6.1

Minor detail, it still shows "Quit lvs_install.lym" in the klayout app menu. image

klayoutmatthias commented 9 months ago

Hi @Kazzz-S,

By merging the pull request, this ticket got closed. Please feel free to reopen if you find it is still not working.

Best regards,

Matthias

Kazzz-S commented 9 months ago

Hello @klayoutmatthias,

Thanks a lot for fixing this problem. I was out yesterday and am now testing. So far, so good! Closing this ticket is OK. I'll add the final test results tomorrow.

Best regards, Kazzz-S

Kazzz-S commented 9 months ago

Hello @klayoutmatthias,

Applying the patch, I have tested it in several environments. The table below summarizes the test results.

Srl.No. OS (Intel CPU) Qt Problem / Status Remarks
1 Monterey (12.7) 6.6.1 Homebrew fixed (1)
2 -ditto- 6.4.3 MacPorts fixed
3 Linux Mint 20.3 6.6.1 source build fixed (2)
4 Monterey (12.7) 5.15.12 Homebrew n/a; no side effect
5 -ditto- 5.15.12 MacPorts n/a; no side effect
6 Linux Mint 20.3 5.15.7 source build n/a; no side effect (2)

(1) Some images for Serial No.1 (Homebrew) HB-1 HB-2 HB-3

(2) Test-7 (same as Test-6)

#!/bin/bash
#--------------------------------------------------------------------
# File: gh1602-test7.sh
#
# Description: Startup script for testing the cases suggested in
#              https://github.com/KLayout/klayout/issues/1602
#
# Test-4: With debug codes added to "layMainWindow.cc"
#         to catch some exceptions while "do_close ()".
#         'MAGIC_FORCE_TRUE' env. variable is also unset.
#
# Test-6: Changed "layApplication.cc" to report about do_notify().
#         This is activated by the two environment variables:
#             * MAGIC_MAINWINDOW_EXITED="ACTIVE"
#             * MAGIC_REPORT_NOTIFY="ACTIVE"
#--------------------------------------------------------------------
SCRIPT_DIR=$(cd $(dirname $(readlink -f $0 || echo $0));pwd -P)

KLAYOUT_LIBS=$SCRIPT_DIR
KLAYOUT_EXE=$SCRIPT_DIR/klayout
RLATED_LIBS=/usr/local/lib

export LD_LIBRARY_PATH=$KLAYOUT_LIBS:$RLATED_LIBS:$LD_LIBRARY_PATH

unset MAGIC_FORCE_TRUE
export MAGIC_MAINWINDOW_EXITED="ACTIVE"
eval "$KLAYOUT_EXE -style=fusion $*  > ./gh1602-test7.log 2>&1"

The output log files are in test7-logs.zip

Once again, thank you for your effort in fixing this long-lasting problem. Kazzz-S

klayoutmatthias commented 9 months ago

@Kazzz-S Thanks for this final report. I'm sorry I cause a lot of work with a small mistake, but I really could not see the effect.

Best regards,

Matthias