use pbd's gstdio compatibility wrapper
[ardour.git] / libs / ardour / export_handler.cc
index 37e5f11455b42076faee5835c6c56ad6fe53b518..0def821ef623b5bb874268a74c40098cf96b9940 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "ardour/export_handler.h"
 
-#include <glib/gstdio.h>
+#include <pbd/gstdio_compat.h>
 #include <glibmm.h>
 #include <glibmm/convert.h>
 
@@ -118,7 +118,7 @@ ExportHandler::ExportHandler (Session & session)
 
 ExportHandler::~ExportHandler ()
 {
-    graph_builder->cleanup (export_status->aborted () );
+       graph_builder->cleanup (export_status->aborted () );
 }
 
 /** Add an export to the `to-do' list */
@@ -310,6 +310,13 @@ ExportHandler::finish_timespan ()
                }
 
                if (fmt->tag()) {
+                       /* close file first, otherwise TagLib enounters an ERROR_SHARING_VIOLATION
+                        * The process cannot access the file because it is being used.
+                        *
+                        * TODO: check Umlauts and encoding in filename.
+                        * TagLib eventually calls CreateFileA(),
+                        */
+                       graph_builder->reset ();
                        AudiofileTagger::tag_file(filename, *SessionMetadata::Metadata());
                }