[GRASS-dev] [GRASS GIS] #3009: "Quit GRASS GIS" button only exits GUI

#3009: "Quit GRASS GIS" button only exits GUI
-------------------------------------+-------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: unspecified
Keywords: "quit grass gis button" | CPU: Unspecified
Platform: Unspecified |
-------------------------------------+-------------------------
For some time, quitting GRASS from the GUI opens a dialog (see attached)
with buttons to "Close GUI" and "Quit GRASS GIS".

But both do the same thing: quitting the GUI but not exiting GRASS. At
least that is what happens on the Mac. Is this the case on other platforms
too?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------
Changes (by cmbarton):

* Attachment "GRASS_quit_dialog.png" added.

Quit GRASS dialog

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------
Changes (by annakrat):

* platform: Unspecified => MacOSX

Comment:

Yes, other platforms work.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.7
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by martinl):

Still relevant?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.7
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by cmbarton):

Yes. Quit GRASS button does not work on the Mac

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------
Changes (by martinl):

* milestone: 7.0.7 => 7.6.2

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by nila):

This is still an issue with 7.8 branch and master (7.9.dev), with Python
3.8.2 and wxPython 4.0.7.post2.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by nila):

I believe I have found the cause of this issue.

In gui/wxpython/lmgr/frame.py:2533-2536 `GMFrame.OnCloseWindowOrExit()`:
{{{
         if ret != wx.ID_CANCEL:
             self._closeWindow(event)
             if ret == wx.ID_YES:
                 self._quitGRASS()
}}}

in `self._closeWindow` self (the GMFrame) will be destroyed and
`self._quitGRASS` will never be reached.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by nila):

I was wrong in my previous assessment.

Now I found the bug and the [https://github.com/OSGeo/grass/pull/408
PR#408] may fix this issue.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:9&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by annakrat):

Replying to [comment:8 nila]:
> I believe I have found the cause of this issue.
>
> In gui/wxpython/lmgr/frame.py:2533-2536 `GMFrame.OnCloseWindowOrExit()`:
> {{{
> if ret != wx.ID_CANCEL:
> self._closeWindow(event)
> if ret == wx.ID_YES:
> self._quitGRASS()
> }}}
>
> in `self._closeWindow` self (the GMFrame) will be destroyed and
`self._quitGRASS` will never be reached.

Are you sure this is not the case? It seems like that would be a problem.
Not sure what the solution would be, perhaps moving the os.kill to the
GMApp OnExit handler.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:10&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.3
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------
Changes (by neteler):

* milestone: 7.6.2 => 7.8.3

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:11&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.3
Component: wxGUI | Version: unspecified
Resolution: | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------

Comment (by nila):

This issue has been solved for bash and zsh terminal with
[https://github.com/OSGeo/grass/pull/722 PR722].

The cause of the problem is that some shells often ignore SIGTERM when
interactive, which is the case - as it seems - for e.g. mac and FreeBSD
shells.

Adding a `trap "exit" TERM` did the trick.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:12&gt;
GRASS GIS <https://grass.osgeo.org>

#3009: "Quit GRASS GIS" button only exits GUI
--------------------------+-------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.3
Component: wxGUI | Version: unspecified
Resolution: fixed | Keywords: "quit grass gis button"
       CPU: Unspecified | Platform: MacOSX
--------------------------+-------------------------------------
Changes (by nila):

* status: new => closed
* resolution: => fixed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3009#comment:13&gt;
GRASS GIS <https://grass.osgeo.org>