[Issue 6223] New: Crash on exit when embeeding std.stream.File in a class.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 29 14:23:55 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6223
Summary: Crash on exit when embeeding std.stream.File in a
class.
Product: D
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: nobody at puremagic.com
ReportedBy: gamezelda2 at gmail.com
--- Comment #0 from gamezelda2 at gmail.com 2011-06-29 14:18:56 PDT ---
The following piece of code seems to crash consistently on Windows (but it
seems to also affect Linux, and that's where I found it - particularly, it only
seemed to crash depending on the content of a static constructor: removing
almost any line from it removed the crash; the minimal test case was large, so
I have not included it).
import std.stream;
import std.stdio;
class X
{
Stream output;
this(Stream output)
{
this.output = output;
}
void close()
{
output.close();
}
~this()
{
close();
}
}
int main(string[] args)
{
new X(new std.stream.File("x.log", FileMode.OutNew));
return 0;
}
Adding "writeln(output.isOpen);" to the close() method removes the crash (and
returns true before .close() and false after .close(), as one would expect). On
the large test case for Linux, however, the crash persisted even with isOpen(),
and just "touching" the object crashed the program (it looked like I was
working with an already released object).
PS: Sorry if I'm missing something obvious and this is a not a bug, but the
behaviour is odd, at least. Also, I posted a message directly to the mailing
list - I found that bugzilla.digitalmars.com was only for DMC, so I thought
that I should use the mailing list for D directory - sorry!
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list