[m-rev.] diff: .NET back-end: close files properly

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Feb 14 04:36:16 AEDT 2003


Estimated hours taken: 1
Branches: main

library/io.m:
	Fix a bug in the MC++ definition mercury_fclose():
	it was not flushing the StreamWriter object
	before closing the underlying stream.

Workspace: /home/fjh/ws/hermes
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.288
diff -u -d -r1.288 io.m
--- library/io.m	13 Feb 2003 08:28:43 -0000	1.288
+++ library/io.m	13 Feb 2003 17:35:39 -0000
@@ -4309,6 +4309,14 @@
 static void
 mercury_close(MR_MercuryFile mf)
 {
+	if (mf->reader) {
+		mf->reader->Close();
+		mf->reader = NULL;
+	}
+	if (mf->writer) {
+		mf->writer->Close();
+		mf->writer = NULL;
+	}
 	mf->stream->Close();
 	mf->stream = NULL;
 }
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list