瀏覽代碼

vlib: fix https://trac.osgeo.org/grass/changeset/55681 side-affect for external formats (Vect__delete() recursive call)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55707 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 年之前
父節點
當前提交
a644db1e21
共有 2 個文件被更改,包括 11 次插入6 次删除
  1. 1 4
      lib/vector/Vlib/close.c
  2. 10 2
      lib/vector/Vlib/close_nat.c

+ 1 - 4
lib/vector/Vlib/close.c

@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+
 #include <grass/vector.h>
 #include <grass/glocale.h>
 
@@ -218,10 +219,6 @@ int Vect_close(struct Map_info *Map)
 	}
     }
 
-    if (Map->temporary) {
-        Vect__delete(Map->name, TRUE);
-    }
-
     G_free(Map->name);
     G_free(Map->mapset);
     G_free(Map->location);

+ 10 - 2
lib/vector/Vlib/close_nat.c

@@ -5,7 +5,7 @@
 
    Higher level functions for reading/writing/manipulating vectors.
 
-   (C) 2001-2009 by the GRASS Development Team
+   (C) 2001-2009, 2013 by the GRASS Development Team
 
    This program is free software under the GNU General Public License
    (>=v2).  Read the file COPYING that comes with GRASS for details.
@@ -15,10 +15,13 @@
 */
 
 #include <stdlib.h>
+
 #include <grass/vector.h>
 
+#include "local_proto.h"
+
 /*!
-  \brief Close vector map file
+  \brief Close vector map
 
   \param Map vector map to be closed
   
@@ -47,5 +50,10 @@ int V1_close_nat(struct Map_info *Map)
     fclose(Map->dig_fp.file);
     dig_file_free(&(Map->dig_fp));
 
+    /* delete temporary map */
+    if (Map->temporary) {
+        Vect__delete(Map->name, TRUE);
+    }
+
     return 0;
 }