Explorar o código

init: clean mapset only after locking it (fixes https://trac.osgeo.org/grass/ticket/613, see https://trac.osgeo.org/grass/ticket/1286)

Only after we set the user-requested mapset as current (GISRC) and lock it,
we can do the startup cleaning using clean_temp (to clean after previous sessions
if needed).

The cleaning was in place at least since https://trac.osgeo.org/grass/changeset/11260 but it got moved to a wrong place some
time after that but before r37863.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73342 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras %!s(int64=6) %!d(string=hai) anos
pai
achega
4e670a3a2e
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      lib/init/grass.py

+ 5 - 4
lib/init/grass.py

@@ -2081,10 +2081,6 @@ def main():
                     "See also: https://grass.osgeo.org/{cmd_name}/manuals/helptext.html").format(
                         cmd_name=cmd_name, gisrcrc=gisrcrc))
         create_initial_gisrc(gisrc)
-    else:
-        # clean only for user who is no first time
-        # (measured by presence of rc file)
-        clean_temp()
 
     message(_("Starting GRASS GIS..."))
 
@@ -2142,6 +2138,11 @@ def main():
     # unlock the mapset which is current at the time of turning off
     # in case mapset was changed
     atexit.register(lambda: unlock_gisrc_mapset(gisrc, gisrcrc))
+    # We now own the mapset (set and lock), so we can clean temporary
+    # files which previous session may have left behind. We do it even
+    # for first time user because the cost is low and first time user
+    # doesn't necessarily mean that the mapset is used for the first time.
+    clean_temp()
     # clean always at exit, cleans whatever is current mapset based on
     # the GISRC env variable
     atexit.register(clean_temp)