Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java	(revision 3275)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java	(revision 3276)
@@ -58,15 +58,18 @@
     @Override
     public void run() {
-        System.out.println("AutoSaving data to file " + file.getAbsolutePath());
 
-        try {
+        try {            
             XmlWriter.OsmWriterInterface writer = getXmlWriter();
             if(writer != null) {
+                // write to temporary file, on success, rename tmp file to target file:
+                File tmpFile = new File(file.getAbsoluteFile()+".tmp");
+                System.out.println("AutoSaving data to file " + file.getAbsolutePath());
                 // synchronize on layer to prevent concurrent adding of data to the layer
                 // quite a hack, but no other object to sync available :-(
                 // @see LiveGpsLayer
                 synchronized(LiveGpsLock.class) {
-                    XmlWriter.output(new FileOutputStream(file), writer);
-                }                
+                    XmlWriter.output(new FileOutputStream(tmpFile), writer);
+                }   
+                tmpFile.renameTo(file);
             }
         } catch (IOException x) {
