[gobject-introspection] scannerparser.y: Really remove temp .h file on Windows



commit e65915cd4fc6a69bd68d2193607f83f9815fe80e
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Apr 25 12:08:15 2017 +0800

    scannerparser.y: Really remove temp .h file on Windows
    
    In gi_source_scanner_parse_macros(), a temporary .h file is generated
    during the process of parsing the macros, and they aren't being deleted
    on Windows.  In turns out that the g_unlink() call in that function failed
    because Windows does not allow one to unlink/delete files while they are
    open, and that the g_unlink() call is done way early (for some reason).
    
    Fix this by calling fclose() on the fmacros FILE* *after* we are done
    with fmacros, and then finally call g_unlink() on the temp .h file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781525

 giscanner/scannerparser.y |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index 6cbf36a..4a40d6a 100644
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -1617,7 +1617,6 @@ gi_source_scanner_parse_macros (GISourceScanner *scanner, GList *filenames)
     fdopen (g_file_open_tmp ("gen-introspect-XXXXXX.h", &tmp_name, &error),
             "w+");
   GList *l;
-  g_unlink (tmp_name);
 
   for (l = filenames; l != NULL; l = l->next)
     {
@@ -1756,6 +1755,8 @@ gi_source_scanner_parse_macros (GISourceScanner *scanner, GList *filenames)
 
   rewind (fmacros);
   gi_source_scanner_parse_file (scanner, fmacros);
+  fclose (fmacros);
+  g_unlink (tmp_name);
 }
 
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]