summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2017-04-25 12:08:15 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2017-05-01 09:13:15 +0800
commite65915cd4fc6a69bd68d2193607f83f9815fe80e (patch)
tree0689cbce97f4f27b320eee969465f880d46415bc
parent50195f846e303d5a0955b991d4cf60f4150fdad1 (diff)
downloadgobject-introspection-e65915cd4fc6a69bd68d2193607f83f9815fe80e.tar.gz
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
-rw-r--r--giscanner/scannerparser.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index 6cbf36ad..4a40d6a4 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